diff --git a/src/lib/legacy/viewplugins/function.adminpanelmenu.php b/src/lib/legacy/viewplugins/function.adminpanelmenu.php
index 307b8cb31e..fb28ad7f54 100644
--- a/src/lib/legacy/viewplugins/function.adminpanelmenu.php
+++ b/src/lib/legacy/viewplugins/function.adminpanelmenu.php
@@ -43,6 +43,7 @@ function smarty_function_adminpanelmenu($params, Zikula_View $view)
// add override for panel width created from .scss file
PageUtil::addVar('stylesheet', '@ZikulaAdminModule/Resources/public/css/mmenu-hiddenpanel-customwidth.css');
+ $router = $view->getContainer()->get('router');
$modules = ModUtil::getModulesCapableOf('admin');
// sort modules by displayname
$moduleNames = array();
@@ -60,11 +61,9 @@ function smarty_function_adminpanelmenu($params, Zikula_View $view)
if (SecurityUtil::checkPermission("module[name]::", '::', ACCESS_EDIT)) {
// first-level list - list modules with general 'index' link
$img = ModUtil::getModuleImagePath($module['name']);
- try {
- $url = ModUtil::url($module['name'], 'admin', 'index');
- } catch (\Exception $e) {
- $url = '#';
- }
+ $url = isset($module['capabilities']['admin']['url'])
+ ? $module['capabilities']['admin']['url']
+ : $router->generate($module['capabilities']['admin']['route']);
$moduleSelected = empty($moduleSelected) && strpos($view->getRequest()->getUri(), $module['url']) ? " class='Selected'" : "";
$htmlContent .= "
" . $module['displayname'] . "";
try {
@@ -72,7 +71,7 @@ function smarty_function_adminpanelmenu($params, Zikula_View $view)
} catch (\Exception $e) {
$links = array();
}
- if (count($links) > 0) {
+ if ((count($links) > 0) && ($links[0] != false)) {
// create second-level list from module adminLinks
$htmlContent .= '';
foreach ($links as $link) {
diff --git a/src/system/Zikula/Module/AdminModule/Controller/AdminController.php b/src/system/Zikula/Module/AdminModule/Controller/AdminController.php
index a84e2d4187..f4678e74ae 100644
--- a/src/system/Zikula/Module/AdminModule/Controller/AdminController.php
+++ b/src/system/Zikula/Module/AdminModule/Controller/AdminController.php
@@ -362,7 +362,7 @@ public function adminpanelAction($acid = null)
$displayNameType = $this->getVar('displaynametype', 1);
// get admin capable modules
- $adminmodules = ModUtil::getAdminMods();
+ $adminmodules = ModUtil::getModulesCapableOf('admin');
$adminlinks = array();
foreach ($adminmodules as $adminmodule) {
if (SecurityUtil::checkPermission("{$adminmodule['name']}::", 'ANY', ACCESS_EDIT)) {
@@ -371,26 +371,27 @@ public function adminpanelAction($acid = null)
$order = ModUtil::apiFunc('ZikulaAdminModule', 'admin', 'getSortOrder',
array('mid' => ModUtil::getIdFromName($adminmodule['name'])));
if (($catid == $acid) || (($catid == false) && ($acid == $this->getVar('defaultcategory')))) {
- $modinfo = ModUtil::getInfoFromName($adminmodule['name']);
- $menutexturl = ModUtil::url($modinfo['name'], 'admin', 'index');
+ $menutexturl = isset($adminmodule['capabilities']['admin']['url'])
+ ? $adminmodule['capabilities']['admin']['url']
+ : $this->get('router')->generate($adminmodule['capabilities']['admin']['route']);
if ($displayNameType == 1) {
- $menutext = $modinfo['displayname'];
+ $menutext = $adminmodule['displayname'];
} elseif ($displayNameType == 2) {
- $menutext = $modinfo['name'];
+ $menutext = $adminmodule['name'];
} elseif ($displayNameType == 3) {
- $menutext = $modinfo['displayname'] . ' (' . $modinfo['name'] . ')';
+ $menutext = $adminmodule['displayname'] . ' (' . $adminmodule['name'] . ')';
}
- $menutexttitle = $modinfo['description'];
+ $menutexttitle = $adminmodule['description'];
$adminicon = ModUtil::getModuleImagePath($adminmodule['name']);
$adminlinks[] = array('menutexturl' => $menutexturl,
'menutext' => $menutext,
'menutexttitle' => $menutexttitle,
- 'modname' => $modinfo['name'],
+ 'modname' => $adminmodule['name'],
'adminicon' => $adminicon,
- 'id' => $modinfo['id'],
+ 'id' => $adminmodule['id'],
'order'=> $order);
}
}
@@ -557,7 +558,7 @@ public function categorymenuAction($acid = null)
}
// get admin capable modules
- $adminmodules = ModUtil::getAdminMods();
+ $adminmodules = ModUtil::getModulesCapableOf('admin');
$adminlinks = array();
foreach ($adminmodules as $adminmodule) {
@@ -565,7 +566,9 @@ public function categorymenuAction($acid = null)
$catid = ModUtil::apiFunc('ZikulaAdminModule', 'admin', 'getmodcategory', array('mid' => $adminmodule['id']));
$order = ModUtil::apiFunc('ZikulaAdminModule', 'admin', 'getSortOrder',
array('mid' => ModUtil::getIdFromName($adminmodule['name'])));
- $menutexturl = ModUtil::url($adminmodule['name'], 'admin', 'index');
+ $menutexturl = isset($adminmodule['capabilities']['admin']['url'])
+ ? $adminmodule['capabilities']['admin']['url']
+ : $this->get('router')->generate($adminmodule['capabilities']['admin']['route']);
$menutext = $adminmodule['displayname'];
$menutexttitle = $adminmodule['description'];
$adminlinks[$catid][] = array('menutexturl' => $menutexturl,
diff --git a/src/system/Zikula/Module/AdminModule/Controller/AjaxController.php b/src/system/Zikula/Module/AdminModule/Controller/AjaxController.php
index 75aada85da..3c0bc3a6f8 100644
--- a/src/system/Zikula/Module/AdminModule/Controller/AjaxController.php
+++ b/src/system/Zikula/Module/AdminModule/Controller/AjaxController.php
@@ -59,6 +59,9 @@ public function changeModuleCategoryAction()
//get the module name
$displayname = DataUtil::formatForDisplay($module['displayname']);
+ $url = isset($module['capabilities']['admin']['url'])
+ ? $module['capabilities']['admin']['url']
+ : $this->get('router')->generate($module['capabilities']['admin']['route']);
$module = $module['name'];
$oldcid = ModUtil::apiFunc('ZikulaAdminModule', 'admin', 'getmodcategory', array('mid' => $moduleID));
@@ -71,7 +74,7 @@ public function changeModuleCategoryAction()
$output = array(
'id' => $moduleID,
'name' => $displayname,
- 'url' => ModUtil::url($module, 'admin', 'index'),
+ 'url' => $url,
'parentCategory' => $newParentCat,
'oldCategory' => $oldcid,
);
diff --git a/src/system/Zikula/Module/BlocksModule/Api/MenutreeApi.php b/src/system/Zikula/Module/BlocksModule/Api/MenutreeApi.php
index a1909b6f0f..6b9b7be099 100644
--- a/src/system/Zikula/Module/BlocksModule/Api/MenutreeApi.php
+++ b/src/system/Zikula/Module/BlocksModule/Api/MenutreeApi.php
@@ -132,7 +132,7 @@ public function adminlinks($args)
}
// Now work on admin capable modules
- $adminmodules = ModUtil::getAdminMods();
+ $adminmodules = ModUtil::getModulesCapableOf('admin');
$displayNameType = ModUtil::getVar('ZikulaAdminModule', 'displaynametype', 1);
$default_cid = ModUtil::getVar('ZikulaAdminModule', 'startcategory');
$adminlinks = array();
@@ -143,20 +143,20 @@ public function adminlinks($args)
array('mid' => ModUtil::getIdFromName($adminmodule['name'])));
$cid = (isset($catinfo[$cid])) ? $cid : $default_cid; // make sure each module is assigned a category
- $modinfo = ModUtil::getInfo(ModUtil::getIdFromName($adminmodule['name']));
-
- if ($modinfo['type'] == 2 || $modinfo['type'] == 3) {
- $menutexturl = ModUtil::url($modinfo['name'], 'admin', 'index');
+ if ($adminmodule['type'] == 2 || $adminmodule['type'] == 3) {
+ $menutexturl = isset($adminmodule['capabilities']['admin']['url'])
+ ? $adminmodule['capabilities']['admin']['url']
+ : $this->get('router')->generate($adminmodule['capabilities']['admin']['route']);
} else {
- $menutexturl = 'admin.php?module=' . $modinfo['name'];
+ $menutexturl = 'admin.php?module=' . $adminmodule['name'];
}
if ($displayNameType == 1) {
- $menutext = $modinfo['displayname'];
+ $menutext = $adminmodule['displayname'];
} elseif ($displayNameType == 2) {
- $menutext = $modinfo['name'];
+ $menutext = $adminmodule['name'];
} elseif ($displayNameType == 3) {
- $menutext = $modinfo['displayname'] . ' (' . $modinfo['name'] . ')';
+ $menutext = $adminmodule['displayname'] . ' (' . $adminmodule['name'] . ')';
}
$adminlinks[] = array(
@@ -164,7 +164,7 @@ public function adminlinks($args)
'id' => $idoffset++,
'name' => $menutext,
'href' => $menutexturl,
- 'title' => $modinfo['description'],
+ 'title' => $adminmodule['description'],
'className' => '',
'state' => 1,
'lang' => $lang,