Fixed gh-394 so to be able to target the component instead of a single view.

This commit is contained in:
2019-05-06 03:05:15 +02:00
parent d7b555e7af
commit a23f1fe79a
7 changed files with 48 additions and 30 deletions

View File

@ -2700,7 +2700,10 @@ class Fields extends Structure
$otherViews = $view_name_list;
$otherView = $view_name_single;
}
$this->categoryBuilder[$view_name_list] = array('code' => $name, 'name' => $listLangName);
// get the xml extension name
$_extension = $this->setPlaceholders(ComponentbuilderHelper::getBetween($field['settings']->xml, 'extension="', '"'), $this->placeholders);
// load the category builder
$this->categoryBuilder[$view_name_list] = array('code' => $name, 'name' => $listLangName, 'extension' => $_extension);
// also set code name for title alias fix
$this->catCodeBuilder[$view_name_single] = array('code' => $name, 'views' => $otherViews, 'view' => $otherView);
}

View File

@ -13464,7 +13464,19 @@ class Interpretation extends Fields
}
if (isset($this->categoryBuilder[$nameList]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$nameList]) && !in_array($otherViews, $catArray))
{
$menus .= PHP_EOL . $this->_t(2) . $tab . "JHtmlSidebar::addEntry(JText:" . ":_('" . $this->categoryBuilder[$nameList]['name'] . "'), 'index.php?option=com_categories&view=categories&extension=com_" . $codeName . "." . $otherViews . "', \$submenu === 'categories." . $otherViews . "');";
// get the extention array
$_extetion_array = explode('.', $this->categoryBuilder[$nameList]['extension']);
// set the meny selection
if (isset($_extetion_array[1]))
{
$_menu = "categories." . trim($_extetion_array[1]);
}
else
{
$_menu = "categories";
}
// now load the menus
$menus .= PHP_EOL . $this->_t(2) . $tab . "JHtmlSidebar::addEntry(JText:" . ":_('" . $this->categoryBuilder[$nameList]['name'] . "'), 'index.php?option=com_categories&view=categories&extension=" . $this->categoryBuilder[$nameList]['extension'] . "', \$submenu === '" . $_menu ."');";
// make sure we add a category only once
$catArray[] = $otherViews;
}