mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2025-01-26 22:08:27 +00:00
Improve menu params handling
This commit is contained in:
parent
1bc0b8ea82
commit
efae6df533
@ -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))
|
||||
{
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user