From df8782dbda92e1ce5ff4763303b4b39eaea7c712 Mon Sep 17 00:00:00 2001 From: Sonny Le Date: Wed, 31 Jul 2024 15:05:09 +0700 Subject: [PATCH] Update Image Group Widget use Masonry --- framework/elements/imagegroup/imagegroup.php | 14 +++++++------- framework/elements/imagegroup/imagegroup.xml | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/framework/elements/imagegroup/imagegroup.php b/framework/elements/imagegroup/imagegroup.php index 4c9b6746..a3421f91 100644 --- a/framework/elements/imagegroup/imagegroup.php +++ b/framework/elements/imagegroup/imagegroup.php @@ -13,7 +13,7 @@ // No direct access. defined('_JEXEC') or die; -use Joomla\CMS\Factory; +use Astroid\Framework; use Astroid\Helper\Style; extract($displayData); @@ -27,6 +27,7 @@ } $enable_slider = $params->get('enable_slider', 0); +$use_masonry = $params->get('use_masonry', 0); $slider_autoplay = $params->get('slider_autoplay', 0); $slider_nav = $params->get('slider_nav', 1); $slider_dotnav = $params->get('slider_dotnav', 0); @@ -144,7 +145,7 @@ $text_color_mode = $params->get('text_color_mode', ''); $text_color_mode = $text_color_mode !== '' ? ' ' . $text_color_mode : ''; -echo '
'; +echo '
'; foreach ($images as $image) { $image_params = Style::getSubFormParams($image->params); if (!empty($image_params['image'])) { @@ -162,10 +163,9 @@ } } echo '
'; +$document = Framework::getDocument(); if ($enable_slider) { - $mainframe = Factory::getApplication(); - $wa = $mainframe->getDocument()->getWebAssetManager(); - $wa->registerAndUseStyle('slick.css', 'astroid/slick.min.css'); - $wa->registerAndUseScript('slick.js', 'astroid/slick.min.js', ['relative' => true, 'version' => 'auto'], [], ['jquery']); - echo ''; + $document->loadSlick('#'.$element->id.' .astroid-slick', implode(',', $slide_settings)); +} elseif ($use_masonry) { + $document->loadMasonry(); } \ No newline at end of file diff --git a/framework/elements/imagegroup/imagegroup.xml b/framework/elements/imagegroup/imagegroup.xml index 79e18fe8..ec66d96f 100644 --- a/framework/elements/imagegroup/imagegroup.xml +++ b/framework/elements/imagegroup/imagegroup.xml @@ -204,6 +204,7 @@ +