From 3a2efc583885fae541a229409eef7895e00e950c Mon Sep 17 00:00:00 2001 From: Tuan Pham Ngoc Date: Thu, 28 Oct 2021 18:43:34 +0700 Subject: [PATCH 1/4] Improve weblinks parameter handling in weblinks module --- .../components/com_weblinks/forms/weblink.xml | 4 ++-- src/modules/mod_weblinks/mod_weblinks.xml | 11 ----------- .../mod_weblinks/src/Helper/WeblinksHelper.php | 10 +++++++--- src/modules/mod_weblinks/tmpl/default.php | 2 +- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/administrator/components/com_weblinks/forms/weblink.xml b/src/administrator/components/com_weblinks/forms/weblink.xml index 42574b10a34..07123fefc11 100644 --- a/src/administrator/components/com_weblinks/forms/weblink.xml +++ b/src/administrator/components/com_weblinks/forms/weblink.xml @@ -263,9 +263,9 @@ diff --git a/src/modules/mod_weblinks/mod_weblinks.xml b/src/modules/mod_weblinks/mod_weblinks.xml index 2b730e97d70..e7fe725c6a2 100644 --- a/src/modules/mod_weblinks/mod_weblinks.xml +++ b/src/modules/mod_weblinks/mod_weblinks.xml @@ -146,17 +146,6 @@ - - - - -
diff --git a/src/modules/mod_weblinks/src/Helper/WeblinksHelper.php b/src/modules/mod_weblinks/src/Helper/WeblinksHelper.php index ff9f11a160c..4cbdab1621a 100644 --- a/src/modules/mod_weblinks/src/Helper/WeblinksHelper.php +++ b/src/modules/mod_weblinks/src/Helper/WeblinksHelper.php @@ -41,8 +41,8 @@ public static function getList($params, $app) ->createModel('Category', 'Site', ['ignore_request' => true]); // Set application parameters in model - $appParams = $app->getParams(); - $model->setState('params', $appParams); + $cParams = ComponentHelper::getParams('com_weblinks'); + $model->setState('params', $cParams); // Set the filters based on the module params $model->setState('list.start', 0); @@ -101,7 +101,11 @@ public static function getList($params, $app) { foreach ($items as $item) { - if ($item->params->get('count_clicks', $params->get('count_clicks')) == 1) + $temp = $item->params; + $item->params = clone $cParams; + $item->params->merge($temp); + + if ($item->params->get('count_clicks', 1) == 1) { $item->link = Route::_('index.php?option=com_weblinks&task=weblink.go&catid=' . $item->catslug . '&id=' . $item->slug); } diff --git a/src/modules/mod_weblinks/tmpl/default.php b/src/modules/mod_weblinks/tmpl/default.php index 525b183a822..b75bb3d6dd1 100644 --- a/src/modules/mod_weblinks/tmpl/default.php +++ b/src/modules/mod_weblinks/tmpl/default.php @@ -100,7 +100,7 @@
link; ?> params->get('target', $params->get('target'))) + switch ($item->params->get('target')) { case 1: // Open in a new window From ead943e2d1fe016922a9208c5fe054bdf0598a7b Mon Sep 17 00:00:00 2001 From: Tuan Pham Ngoc Date: Fri, 29 Oct 2021 15:52:38 +0700 Subject: [PATCH 2/4] Some corrections to weblinks module layout --- src/modules/mod_weblinks/tmpl/default.php | 27 ++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/modules/mod_weblinks/tmpl/default.php b/src/modules/mod_weblinks/tmpl/default.php index b75bb3d6dd1..0e1359886cd 100644 --- a/src/modules/mod_weblinks/tmpl/default.php +++ b/src/modules/mod_weblinks/tmpl/default.php @@ -9,8 +9,9 @@ defined('_JEXEC') or die; -use Joomla\CMS\Language\Text; use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Language\Text; + ?> get('groupby', 0)) : ?> @@ -36,22 +37,25 @@ get('groupby_showtitle', 1)) :?> ; -