Skip to content

Commit

Permalink
fix(formlist): prevent php deprecation
Browse files Browse the repository at this point in the history
conversion from bool to array because getMenuContent may return false
btry committed Apr 5, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent b1f7385 commit 6bc8641
Showing 2 changed files with 6 additions and 10 deletions.
11 changes: 5 additions & 6 deletions inc/formlist.class.php
Original file line number Diff line number Diff line change
@@ -46,12 +46,11 @@ public static function getTypeName($nb = 0) {
return _n('Form', 'Forms', $nb, 'formcreator');
}

public static function getMenuContent() {
$menu = parent::getMenuContent();
$menu['title'] = static::getTypeName(Session::getPluralNumber());
$menu['page'] = PluginFormcreatorFormList::getSearchURL(false);
$menu['icon'] = 'fas fa-edit';
public static function canView() {
return (PluginFormcreatorForm::countAvailableForm() > 0);
}

return $menu;
public static function getIcon() {
return 'fas fa-edit';
}
}
5 changes: 1 addition & 4 deletions setup.php
Original file line number Diff line number Diff line change
@@ -355,10 +355,7 @@ function plugin_formcreator_hook() {
return;
}

// If user have acces to one form or more, add link
if (PluginFormcreatorForm::countAvailableForm() > 0) {
$PLUGIN_HOOKS['menu_toadd']['formcreator']['helpdesk'] = PluginFormcreatorFormlist::class;
}
$PLUGIN_HOOKS['menu_toadd']['formcreator']['helpdesk'] = PluginFormcreatorFormlist::class;

// Massive Action definition
$PLUGIN_HOOKS['use_massive_action']['formcreator'] = 1;

0 comments on commit 6bc8641

Please sign in to comment.