fixed gh-419 to correctly load the category filter (extention and view name)

This commit is contained in:
2019-06-07 16:59:27 +02:00
parent 4a878e32ef
commit 37d3f1425e
8 changed files with 19 additions and 25 deletions

View File

@ -2900,11 +2900,13 @@ class Get
if (ComponentbuilderHelper::checkString($listViewName))
{
// check if we should use another Text Name as this views name
$otherName = ComponentbuilderHelper::getBetween($field['settings']->xml, 'othername="', '"');
$otherViews = ComponentbuilderHelper::getBetween($field['settings']->xml, 'views="', '"');
$otherView = ComponentbuilderHelper::getBetween($field['settings']->xml, 'view="', '"');
$otherName = $this->setPlaceholders(ComponentbuilderHelper::getBetween($field['settings']->xml, 'othername="', '"'), $this->placeholders);
$otherViews = $this->setPlaceholders(ComponentbuilderHelper::getBetween($field['settings']->xml, 'views="', '"'), $this->placeholders);
$otherView = $this->setPlaceholders(ComponentbuilderHelper::getBetween($field['settings']->xml, 'view="', '"'), $this->placeholders);
// This is to link other view category
if (ComponentbuilderHelper::checkString($otherName) && ComponentbuilderHelper::checkString($otherViews) && ComponentbuilderHelper::checkString($otherView))
{
// set other category details
$this->catOtherName[$listViewName] = array(
'name' => ComponentbuilderHelper::safeString($otherName),
'views' => ComponentbuilderHelper::safeString($otherViews),

View File

@ -10947,21 +10947,13 @@ class Interpretation extends Fields
return '';
}
public function setCategoryFilter($viewName_single, $viewName_list)
public function setCategoryFilter($viewName_list)
{
if (isset($this->categoryBuilder[$viewName_list]) && ComponentbuilderHelper::checkArray($this->categoryBuilder[$viewName_list]))
if (isset($this->categoryBuilder[$viewName_list])
&& ComponentbuilderHelper::checkArray($this->categoryBuilder[$viewName_list])
&& isset($this->categoryBuilder[$viewName_list]['extension']))
{
// check if category has another name
if (isset($this->catOtherName[$viewName_list]) && ComponentbuilderHelper::checkArray($this->catOtherName[$viewName_list]))
{
$targetView = "." . $this->catOtherName[$viewName_list]['view'];
}
else
{
$targetView = "." . $viewName_single;
}
// set component name
$component = ComponentbuilderHelper::safeString($this->componentData->name_code);
$COPMONENT = ComponentbuilderHelper::safeString($this->componentData->name_code, 'U');
// set filter
$filter = array();
@ -10969,7 +10961,7 @@ class Interpretation extends Fields
$filter[] = $this->_t(2) . "JHtmlSidebar::addFilter(";
$filter[] = $this->_t(3) . "JText:" . ":_('JOPTION_SELECT_CATEGORY'),";
$filter[] = $this->_t(3) . "'filter_category_id',";
$filter[] = $this->_t(3) . "JHtml::_('select.options', JHtml::_('category.options', 'com_" . $component . $targetView . "'), 'value', 'text', \$this->state->get('filter.category_id'))";
$filter[] = $this->_t(3) . "JHtml::_('select.options', JHtml::_('category.options', '" . $this->categoryBuilder[$viewName_list]['extension'] . "'), 'value', 'text', \$this->state->get('filter.category_id'))";
$filter[] = $this->_t(2) . ");";
@ -10979,7 +10971,7 @@ class Interpretation extends Fields
$filter[] = $this->_t(3) . "JHtmlBatch_::addListSelection(";
$filter[] = $this->_t(4) . "JText:" . ":_('COM_" . $COPMONENT . "_KEEP_ORIGINAL_CATEGORY'),";
$filter[] = $this->_t(4) . "'batch[category]',";
$filter[] = $this->_t(4) . "JHtml::_('select.options', JHtml::_('category.options', 'com_" . $component . $targetView . "'), 'value', 'text')";
$filter[] = $this->_t(4) . "JHtml::_('select.options', JHtml::_('category.options', '" . $this->categoryBuilder[$viewName_list]['extension'] . "'), 'value', 'text')";
$filter[] = $this->_t(3) . ");";
$filter[] = $this->_t(2) . "}";

View File

@ -438,7 +438,7 @@ class Infusion extends Interpretation
$this->fileContentDynamic[$viewName_list][$this->hhh . 'SORTFIELDS' . $this->hhh] = $this->setSortFields($viewName_list);
// CATEGORYFILTER <<<DYNAMIC>>>
$this->fileContentDynamic[$viewName_list][$this->hhh . 'CATEGORYFILTER' . $this->hhh] = $this->setCategoryFilter($viewName_single, $viewName_list);
$this->fileContentDynamic[$viewName_list][$this->hhh . 'CATEGORYFILTER' . $this->hhh] = $this->setCategoryFilter($viewName_list);
// CATEGORY_VIEWS
if (!isset($this->fileContentStatic[$this->hhh . 'ROUTER_CATEGORY_VIEWS' . $this->hhh]))