Skip to content

Commit

Permalink
fix missing menu option for simplified interface
Browse files Browse the repository at this point in the history
  • Loading branch information
cconard96 committed Apr 15, 2024
1 parent 7823310 commit a22049a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
13 changes: 13 additions & 0 deletions hook.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,16 @@ function plugin_webresources_preItemPurge(CommonDBTM $item)
]);
}
}

function plugin_webresources_redefine_menus($menu)
{
$menu['webresources'] = [
'title' => PluginWebresourcesResource::getTypeName(Session::getPluralNumber()),
'default' => PluginWebresourcesDashboard::getSearchURL(false),
'icon' => PluginWebresourcesDashboard::getIcon(),
'links' => [
'search' => PluginWebresourcesDashboard::getSearchURL(false),
],
];
return $menu;
}
7 changes: 6 additions & 1 deletion setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ function plugin_init_webresources()

$plugin = new Plugin();
if ($plugin->isInstalled('webresources') && $plugin->isActivated('webresources')) {
Profile::$helpdesk_rights[] = PluginWebresourcesResource::$rightname;
$config = Config::getConfigurationValues('plugin:Webresources', ['menu']);
if (Session::haveRight(PluginWebresourcesResource::$rightname, READ)) {
$PLUGIN_HOOKS['menu_toadd']['webresources'] = [$config['menu'] ?? 'plugins' => 'PluginWebresourcesDashboard'];
if (Session::getCurrentInterface() === 'central') {
$PLUGIN_HOOKS['menu_toadd']['webresources'] = [$config['menu'] ?? 'plugins' => 'PluginWebresourcesDashboard'];
} else {
$PLUGIN_HOOKS[\Glpi\Plugin\Hooks::REDEFINE_MENUS]['webresources'] = 'plugin_webresources_redefine_menus';
}
}
Plugin::registerClass('PluginWebresourcesProfile', ['addtabon' => ['Profile']]);
Plugin::registerClass('PluginWebresourcesConfig', ['addtabon' => 'Config']);
Expand Down

0 comments on commit a22049a

Please sign in to comment.