Skip to content

Commit

Permalink
Update ImageGroup can view via Lightbox
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed Sep 25, 2024
1 parent 97932e4 commit 0659166
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion framework/elements/imagegroup/imagegroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

$enable_slider = $params->get('enable_slider', 0);
$use_masonry = $params->get('use_masonry', 0);
$use_lightbox = $params->get('use_lightbox', 0);
$slider_autoplay = $params->get('slider_autoplay', 0);
$slider_nav = $params->get('slider_nav', 1);
$slider_dotnav = $params->get('slider_dotnav', 0);
Expand Down Expand Up @@ -169,11 +170,13 @@
echo '<div>';
if ($image_params['use_link']) {
echo '<a href="'.$image_params['link'].'" title="'.$image_params['title'].'">';
} elseif ($use_lightbox) {
echo '<a href="'. Astroid\Helper\Media::getMediaPath($image_params['image']).'" data-fancybox="astroid-'.$element->id.'">';
}
echo '<div class="position-relative overflow-hidden' . $border_radius . $box_shadow . $hover_effect . $transition . '">';
echo '<img src="'. Astroid\Helper\Media::getMediaPath($image_params['image']).'" alt="'.$image_params['title'].'" class="d-inline-block">';
echo '</div>';
if ($image_params['use_link']) {
if ($image_params['use_link'] || $use_lightbox) {
echo '</a>';
}
echo '</div>';
Expand All @@ -182,6 +185,10 @@
echo '</div>';
$document = Framework::getDocument();

if ($use_lightbox) {
$document->loadFancyBox();
$document->addScriptDeclaration('Fancybox.bind(\'[data-fancybox="astroid-'.$element->id.'"]\');', 'body');
}
if ($enable_slider) {
$document->loadSlick('#'.$element->id.' .astroid-slick', implode(',', $slide_settings));
} elseif ($use_masonry) {
Expand Down
1 change: 1 addition & 0 deletions framework/elements/imagegroup/imagegroup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
</field>

<field astroidgroup="widget_styles" ngShow="[enable_slider]==0" name="use_masonry" type="astroidradio" astroid-switch="true" default="0" label="ASTROID_USE_MASONRY"/>
<field astroidgroup="widget_styles" name="use_lightbox" type="astroidradio" astroid-switch="true" default="0" label="ASTROID_WIDGET_VIEW_IN_LIGHTBOX"/>
<field astroidgroup="widget_styles" name="border_radius" type="astroidlist" label="ASTROID_WIDGET_BORDER_RADIUS_LABEL" default="">
<option value="">ASTROID_NONE</option>
<option value="rounded">TPL_ASTROID_ICON_STYLE_ROUNDED</option>
Expand Down
1 change: 1 addition & 0 deletions language/en-GB/en-GB.astroid.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,7 @@ ASTROID_WIDGET_TOP_ICON="<i class='fa-lg as-icon as-icon-align-top me-1'></i> To
ASTROID_WIDGET_MIDDLE_ICON="<i class='fa-lg as-icon as-icon-align-center-horizontal me-1'></i> Middle"
ASTROID_WIDGET_BOTTOM_ICON="<i class='fa-lg as-icon as-icon-align-bottom me-1'></i> Bottom"
ASTROID_WIDGET_DISPLAY="Display"
ASTROID_WIDGET_VIEW_IN_LIGHTBOX="View in Lightbox"

; Joomla Content
ASTROID_SELECT_TEMPLATE="Select a Template"
Expand Down

0 comments on commit 0659166

Please sign in to comment.