Skip to content

Commit 6bc8641

Browse files
committed
fix(formlist): prevent php deprecation
conversion from bool to array because getMenuContent may return false
1 parent b1f7385 commit 6bc8641

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

inc/formlist.class.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@ public static function getTypeName($nb = 0) {
4646
return _n('Form', 'Forms', $nb, 'formcreator');
4747
}
4848

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

55-
return $menu;
53+
public static function getIcon() {
54+
return 'fas fa-edit';
5655
}
5756
}

setup.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,7 @@ function plugin_formcreator_hook() {
355355
return;
356356
}
357357

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

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

0 commit comments

Comments
 (0)