Those top option category links are trying really hard to make one's life miserable.
Previously, the session ID of the active user was cached in the top option category links, which will break them in other sessions/for other users. Now, since these links are different and included in the core, `ACPMenuItem` is allowed to know that there are such "special" links and this it can handle them by building the link with the id of the option category which is cached with them as a "special" value.
<div id="{$_parentMenuItem->menuItem}-container" style="display: none;" class="menuGroup collapsibleMenus" data-parent-menu-item="{$_parentMenuItem->menuItem}">
{foreach from=$__wcf->getACPMenu()->getMenuItems($_parentMenuItem->menuItem) item=_menuItem}
<fieldset>
- <legend class="menuHeader" data-menu-item="{$_menuItem->menuItem}">{$_menuItem}</legend>
+ <legend class="menuHeader" data-menu-item="{$_menuItem->menuItem}">{@$_menuItem}</legend>
<nav class="menuGroupItems">
<ul id="{$_menuItem->menuItem}">
{foreach from=$__wcf->getACPMenu()->getMenuItems($_menuItem->menuItem) item=menuItemCategory}
{if $__wcf->getACPMenu()->getMenuItems($menuItemCategory->menuItem)|count > 0}
{foreach from=$__wcf->getACPMenu()->getMenuItems($menuItemCategory->menuItem) item=subMenuItem}
- <li id="{$subMenuItem->menuItem}" data-menu-item="{$subMenuItem->menuItem}"><a href="{$subMenuItem->getLink()}">{$subMenuItem}</a></li>
+ <li id="{$subMenuItem->menuItem}" data-menu-item="{$subMenuItem->menuItem}"><a href="{$subMenuItem->getLink()}">{@$subMenuItem}</a></li>
{/foreach}
{else}
- <li id="{$menuItemCategory->menuItem}" data-menu-item="{$menuItemCategory->menuItem}"><a href="{$menuItemCategory->getLink()}">{$menuItemCategory}</a></li>
+ <li id="{$menuItemCategory->menuItem}" data-menu-item="{$menuItemCategory->menuItem}"><a href="{$menuItemCategory->getLink()}">{@$menuItemCategory}</a></li>
{/if}
{/foreach}
</ul>
if (!$this->menuItemController) {
return WCF::getLanguage()->get($this->menuItemLink);
}
-
+
$this->parseController();
- return LinkHandler::getInstance()->getLink($this->controller, array('application' => $this->application), WCF::getLanguage()->get($this->menuItemLink));
+
+ $linkParameters = array(
+ 'application' => $this->application
+ );
+
+ // links of top option category menu items need the id of the option
+ // category
+ if ($this->parentMenuItem == 'wcf.acp.menu.link.option.category') {
+ $linkParameters['id'] = $this->optionCategoryID;
+ }
+
+ return LinkHandler::getInstance()->getLink($this->controller, $linkParameters, WCF::getLanguage()->get($this->menuItemLink));
}
/**
*/
public function getController() {
$this->parseController();
-
+
return $this->controller;
}
protected function parseController() {
if ($this->controller === null) {
$this->controller = '';
-
+
// resolve application and controller
if ($this->menuItemController) {
$parts = explode('\\', $this->menuItemController);
$this->application = array_shift($parts);
$menuItemController = array_pop($parts);
-
+
// drop controller suffix
$this->controller = Regex::compile('(Action|Form|Page)$')->replace($menuItemController, '');
}
$data['wcf.acp.menu.link.option.category'][] = new ACPMenuItem(null, array(
'menuItem' => 'wcf.acp.option.category.'.$optionCategory->categoryName,
'parentMenuItem' => 'wcf.acp.menu.link.option.category',
- 'menuItemLink' => LinkHandler::getInstance()->getLink('Option', array(
- 'application' => 'wcf',
- 'id' => $optionCategory->categoryID
- )),
+ 'menuItemController' => 'wcf\acp\form\OptionForm',
'permissions' => $optionCategory->permissions,
+ 'optionCategoryID' => $optionCategory->categoryID,
'options' => $optionCategory->options
));
}