mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-12-25 01:45:59 +00:00
Improve item parameters merging code
This commit is contained in:
parent
f4ef7768e0
commit
925c4518d6
@ -12,7 +12,6 @@ namespace Joomla\Component\Weblinks\Site\View\Category;
|
|||||||
use Joomla\CMS\MVC\View\CategoryView;
|
use Joomla\CMS\MVC\View\CategoryView;
|
||||||
use Joomla\CMS\Router\Route;
|
use Joomla\CMS\Router\Route;
|
||||||
use Joomla\Component\Weblinks\Site\Helper\RouteHelper;
|
use Joomla\Component\Weblinks\Site\Helper\RouteHelper;
|
||||||
use Joomla\Registry\Registry;
|
|
||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
@ -44,9 +43,12 @@ class HtmlView extends CategoryView
|
|||||||
// Compute the weblink slug & link url.
|
// Compute the weblink slug & link url.
|
||||||
foreach ($this->items as $item)
|
foreach ($this->items as $item)
|
||||||
{
|
{
|
||||||
$item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id;
|
$item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id;
|
||||||
|
$temp = $item->params;
|
||||||
|
$item->params = clone $this->params;
|
||||||
|
$item->params->merge($temp);
|
||||||
|
|
||||||
if ($item->params->get('count_clicks', $this->params->get('count_clicks', 1)) == 1)
|
if ($item->params->get('count_clicks', 1) == 1)
|
||||||
{
|
{
|
||||||
$item->link = Route::_('index.php?option=com_weblinks&task=weblink.go&id=' . $item->id);
|
$item->link = Route::_('index.php?option=com_weblinks&task=weblink.go&id=' . $item->id);
|
||||||
}
|
}
|
||||||
@ -54,11 +56,6 @@ class HtmlView extends CategoryView
|
|||||||
{
|
{
|
||||||
$item->link = $item->url;
|
$item->link = $item->url;
|
||||||
}
|
}
|
||||||
|
|
||||||
$temp = new Registry;
|
|
||||||
$temp->loadString($item->params);
|
|
||||||
$item->params = clone $this->params;
|
|
||||||
$item->params->merge($temp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::display($tpl);
|
return parent::display($tpl);
|
||||||
|
@ -65,6 +65,10 @@ class HtmlView extends BaseHtmlView
|
|||||||
|
|
||||||
$item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id;
|
$item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id;
|
||||||
|
|
||||||
|
$temp = $item->params;
|
||||||
|
$item->params = clone $app->getParams();
|
||||||
|
$item->params->merge($temp);
|
||||||
|
|
||||||
$offset = $this->state->get('list.offset');
|
$offset = $this->state->get('list.offset');
|
||||||
|
|
||||||
$app->triggerEvent('onContentPrepare', array('com_weblinks.weblink', &$item, &$item->params, $offset));
|
$app->triggerEvent('onContentPrepare', array('com_weblinks.weblink', &$item, &$item->params, $offset));
|
||||||
|
Loading…
Reference in New Issue
Block a user