Skip to content

Commit

Permalink
Add option to show or hide slideshow controls and indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
Felixkat committed Nov 2, 2024
1 parent 5bbf82a commit 25f50bb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions framework/elements/slideshow/slideshow.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@
$btn_radius = $btn_radius ? ' '. $btn_radius : '';

echo '<div id="slide-'.$element->id.'" class="carousel slide overflow-hidden'. $overlay_text_color . $effect_type . $box_shadow . $box_shadow_hover .$bd_radius .'"'. (intval($autoplay) ? ' data-bs-ride="carousel"' : '') .'>';
if (!empty($indicators)) {
echo '<div class="carousel-indicators">';
for ($key = 0 ; $key < count($slides); $key ++) {
echo '<button type="button" data-bs-target="#slide-'.$element->id.'" data-bs-slide-to="'.$key.'" aria-label="'.$slides[$key]->params['title'].'"'.($key == 0 ? ' class="active" aria-current="true"' : '').'></button>';
}
echo '</div>';
}
echo '<div class="carousel-inner">';
for ($key = 0 ; $key < count($slides); $key ++) {
echo '<div id="' . $slides[$key]->id . '" class="carousel-item'.($key == 0 ? ' active' : '').'" data-bs-interval="'.$interval.'">';
Expand All @@ -119,8 +121,10 @@
echo '</div>';
}
echo '</div>';
if (!empty($controls)) {
echo '<button class="carousel-control-prev" type="button" data-bs-target="#slide-'.$element->id.'" data-bs-slide="prev"><span class="carousel-control-prev-icon" aria-hidden="true"></span><span class="visually-hidden">Previous</span></button>';
echo '<button class="carousel-control-next" type="button" data-bs-target="#slide-'.$element->id.'" data-bs-slide="next"><span class="carousel-control-next-icon" aria-hidden="true"></span><span class="visually-hidden">Next</span></button>';
}
echo '</div>';

$mainframe = Factory::getApplication();
Expand Down
2 changes: 2 additions & 0 deletions framework/elements/slideshow/slideshow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
</field>
<field astroidgroup="slideshow_options" name="autoplay" type="astroidradio" astroid-switch="true" default="0" label="ASTROID_WIDGET_AUTOPLAY"/>
<field astroidgroup="slideshow_options" ngShow="[autoplay]==1" name="interval" type="astroidrange" min="1" max="10" step="1" default="3" label="ASTROID_WIDGET_INTERVAL" postfix="seconds" />
<field astroidgroup="slideshow_options" name="controls" type="astroidradio" astroid-switch="true" default="1" label="ASTROID_WIDGET_CONTROLS"/>
<field astroidgroup="slideshow_options" name="indicators" type="astroidradio" astroid-switch="true" default="1" label="ASTROID_WIDGET_INDICATORS"/>
<field astroidgroup="slideshow_options" type="astroidlist" name="slide_border_radius" label="ASTROID_WIDGET_BORDER_RADIUS_LABEL" default="">
<option value="">TPL_ASTROID_ICON_STYLE_ROUNDED</option>
<option value="0">TPL_ASTROID_ICON_STYLE_SQUARE</option>
Expand Down
2 changes: 2 additions & 0 deletions language/en-GB/en-GB.astroid.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1573,6 +1573,8 @@ ASTROID_WIDGET_EFFECT_TYPE="Effect Type"
ASTROID_WIDGET_EFFECT_TYPE_CAROUSEL="Carousel"
ASTROID_WIDGET_EFFECT_TYPE_FADE="Fade"
ASTROID_WIDGET_ARTICLES_ENABLE_SLIDER="Display Articler as Slider"
ASTROID_WIDGET_CONTROLS="Show Controls"
ASTROID_WIDGET_INDICATORS="Show Indicators"

; Image Group
ASTROID_WIDGET_IMAGE_GROUP_LABEL="Image Group"
Expand Down

0 comments on commit 25f50bb

Please sign in to comment.