mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2025-02-05 02:38:24 +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)
|
if ($this->_items === null)
|
||||||
{
|
{
|
||||||
$active = Factory::getApplication()->getMenu()->getActive();
|
$params = $this->getState('params', new Registry);
|
||||||
|
|
||||||
if ($active)
|
$options = array();
|
||||||
{
|
$options['access'] = $this->getState('filter.access');
|
||||||
$params = $active->getParams();
|
$options['published'] = $this->getState('filter.published');
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$params = new Registry;
|
|
||||||
}
|
|
||||||
|
|
||||||
$options = array();
|
|
||||||
$options['countItems'] = $params->get('show_cat_num_links', 1) || !$params->get('show_empty_categories_cat', 0);
|
$options['countItems'] = $params->get('show_cat_num_links', 1) || !$params->get('show_empty_categories_cat', 0);
|
||||||
$categories = Categories::getInstance('Weblinks', $options);
|
$categories = Categories::getInstance('Weblinks', $options);
|
||||||
$this->_parent = $categories->get($this->getState('filter.parentId', 'root'));
|
$this->_parent = $categories->get($this->getState('filter.parentId', 'root'));
|
||||||
|
|
||||||
if (is_object($this->_parent))
|
if (is_object($this->_parent))
|
||||||
{
|
{
|
||||||
|
@ -246,7 +246,9 @@ class CategoryModel extends ListModel
|
|||||||
protected function populateState($ordering = null, $direction = null)
|
protected function populateState($ordering = null, $direction = null)
|
||||||
{
|
{
|
||||||
$app = Factory::getApplication();
|
$app = Factory::getApplication();
|
||||||
$params = ComponentHelper::getParams('com_weblinks');
|
|
||||||
|
$params = $app->getParams();
|
||||||
|
$this->setState('params', $params);
|
||||||
|
|
||||||
// List state information
|
// List state information
|
||||||
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit'), 'uint');
|
$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');
|
$id = $app->input->get('id', 0, 'int');
|
||||||
$this->setState('category.id', $id);
|
$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'))
|
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());
|
$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))
|
if (!is_object($this->_item))
|
||||||
{
|
{
|
||||||
$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['countItems'] = $params->get('show_cat_num_links_cat', 1)
|
$options['countItems'] = $params->get('show_cat_num_links_cat', 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user