Skip to content

Commit 46a3f89

Browse files
committed
Fix getMenuContent (for savesearches lists)
1 parent 45dbff7 commit 46a3f89

File tree

6 files changed

+33
-74
lines changed

6 files changed

+33
-74
lines changed

front/connection.form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
__('Connections', 'connections'),
101101
$_SERVER["PHP_SELF"],
102102
"assets",
103-
"pluginconnectionsmenu",
103+
"pluginconnectionsconnection",
104104
"connections"
105105
);
106106

front/connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
__('Connections', 'connections'),
3636
$_SERVER["PHP_SELF"],
3737
"assets",
38-
"pluginconnectionsmenu",
38+
"pluginconnectionsconnection",
3939
""
4040
);
4141

hook.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ function plugin_connections_uninstall() {
187187
foreach (PluginConnectionsProfile::getAllRights() as $right) {
188188
$profileRight->deleteByCriteria(['name' => $right['field']]);
189189
}
190-
PluginConnectionsMenu::removeRightsFromSession();
190+
PluginConnectionsConnection::removeRightsFromSession();
191191
PluginConnectionsProfile::removeRightsFromSession();
192192

193193
return true;

inc/connection.class.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,4 +609,33 @@ public function dropdownConnections($myname, $entity_restrict = '', $used = [])
609609
return $rand;
610610
}
611611

612+
/**
613+
* @return array
614+
*/
615+
static function getMenuContent() {
616+
617+
$menu = [];
618+
$menu['title'] = self::getMenuName();
619+
$menu['page'] = self::getSearchURL(false);
620+
$menu['links']['search'] = self::getSearchURL(false);
621+
if (Session::haveRight(static::$rightname, CREATE)) {
622+
$menu['links']['add'] = self::getFormURL(false);
623+
}
624+
$menu['links']['lists'] = "";
625+
626+
$menu['icon'] = self::getIcon();
627+
628+
return $menu;
629+
}
630+
631+
static function removeRightsFromSession()
632+
{
633+
if (isset($_SESSION['glpimenu']['assets']['types']['PluginConnectionsConnection'])) {
634+
unset($_SESSION['glpimenu']['assets']['types']['PluginConnectionsConnection']);
635+
}
636+
if (isset($_SESSION['glpimenu']['assets']['content']['pluginconnectionsconnection'])) {
637+
unset($_SESSION['glpimenu']['assets']['content']['pluginconnectionsconnection']);
638+
}
639+
}
640+
612641
}

inc/menu.class.php

Lines changed: 0 additions & 70 deletions
This file was deleted.

setup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function plugin_init_connections() {
7777
}
7878

7979
if (Session::haveRight("plugin_connections_connection", READ)) {
80-
$PLUGIN_HOOKS["menu_toadd"]['connections'] = ['assets' => 'PluginConnectionsMenu'];
80+
$PLUGIN_HOOKS["menu_toadd"]['connections'] = ['assets' => 'PluginConnectionsConnection'];
8181
}
8282

8383
$CFG_GLPI['impact_asset_types']['PluginConnectionsConnection'] = PLUGINCONNECTIONS_NOTFULL_WEBDIR."/pics/icon.png";

0 commit comments

Comments
 (0)