diff --git a/src/components/com_weblinks/src/Model/CategoriesModel.php b/src/components/com_weblinks/src/Model/CategoriesModel.php index bfb8263..a3cc4bf 100644 --- a/src/components/com_weblinks/src/Model/CategoriesModel.php +++ b/src/components/com_weblinks/src/Model/CategoriesModel.php @@ -112,21 +112,14 @@ class CategoriesModel extends ListModel { if ($this->_items === null) { - $active = Factory::getApplication()->getMenu()->getActive(); + $params = $this->getState('params', new Registry); - if ($active) - { - $params = $active->getParams(); - } - else - { - $params = new Registry; - } - - $options = array(); + $options = array(); + $options['access'] = $this->getState('filter.access'); + $options['published'] = $this->getState('filter.published'); $options['countItems'] = $params->get('show_cat_num_links', 1) || !$params->get('show_empty_categories_cat', 0); - $categories = Categories::getInstance('Weblinks', $options); - $this->_parent = $categories->get($this->getState('filter.parentId', 'root')); + $categories = Categories::getInstance('Weblinks', $options); + $this->_parent = $categories->get($this->getState('filter.parentId', 'root')); if (is_object($this->_parent)) { diff --git a/src/components/com_weblinks/src/Model/CategoryModel.php b/src/components/com_weblinks/src/Model/CategoryModel.php index 1ca68cb..75843f0 100644 --- a/src/components/com_weblinks/src/Model/CategoryModel.php +++ b/src/components/com_weblinks/src/Model/CategoryModel.php @@ -246,7 +246,9 @@ class CategoryModel extends ListModel protected function populateState($ordering = null, $direction = null) { $app = Factory::getApplication(); - $params = ComponentHelper::getParams('com_weblinks'); + + $params = $app->getParams(); + $this->setState('params', $params); // List state information $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'), 'uint'); @@ -279,7 +281,7 @@ class CategoryModel extends ListModel $id = $app->input->get('id', 0, 'int'); $this->setState('category.id', $id); - $user = Factory::getApplication()->getIdentity(); + $user = $app->getIdentity(); if (!$user->authorise('core.edit.state', 'com_weblinks') && !$user->authorise('core.edit', 'com_weblinks')) { @@ -291,9 +293,6 @@ class CategoryModel extends ListModel } $this->setState('filter.language', Multilanguage::isEnabled()); - - // Load the parameters. - $this->setState('params', $params); } /** @@ -307,16 +306,7 @@ class CategoryModel extends ListModel { if (!is_object($this->_item)) { - $active = Factory::getApplication()->getMenu()->getActive(); - - if ($active) - { - $params = $active->getParams(); - } - else - { - $params = new Registry; - } + $params = $this->getState('params', new Registry); $options = array(); $options['countItems'] = $params->get('show_cat_num_links_cat', 1)