-
Notifications
You must be signed in to change notification settings - Fork 12
/
gallery.php
86 lines (83 loc) · 3.38 KB
/
gallery.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* @package Astroid Framework
* @author Astroid Framework Team https://astroidframe.work
* @copyright Copyright (C) 2023 AstroidFrame.work.
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
* DO NOT MODIFY THIS FILE DIRECTLY AS IT WILL BE OVERWRITTEN IN THE NEXT UPDATE
* You can easily override all files under /frontend/ folder.
* Just copy the file to ROOT/templates/YOURTEMPLATE/html/frontend/blog/ folder to create and override
*/
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Language\Text;
// No direct access.
defined('_JEXEC') or die;
extract($displayData);
$params = $article->params;
$items = $params->get('astroid_article_gallery_items', []);
if (empty($items)) {
return;
}
$index = 0;
$active = true;
$width = $params->get('astroid_article_gallery_width', '');
$width = !empty($width) ? 'max-width:' . $width : '';
$hasItems = false;
?>
<div style="<?php echo $width; ?>" id="article-gallery" class="article-gallery carousel uk-margin-medium slide" data-bs-ride="carousel">
<?php if (!empty($params->get('astroid_article_gallery_bullets', 1))) { ?>
<div class="carousel-indicators">
<?php foreach ($items as $item) { ?>
<?php
if (empty($item['image'])) {
continue;
}
?>
<button type="button" data-bs-target="#article-gallery" data-bs-slide-to="<?php echo $index; ?>" class="<?php echo $active ? 'active' : ''; ?>"></button>
<?php
$index++;
$active = false;
}
$active = true;
?>
</div>
<?php } ?>
<div class="carousel-inner">
<?php foreach ($items as $item) { ?>
<?php
if (empty($item['image'])) {
continue;
}
$hasItems = true;
?>
<div class="carousel-item<?php echo $active ? ' active' : ''; ?>">
<?php if (!empty($item['image'])) { ?>
<img class="d-block w-100" src="<?php echo Uri::root() . $item['image']; ?>" alt="<?php echo empty($item['title']) ? '' : $item['title']; ?>">
<?php } ?>
<?php if (!empty($item['title']) || !empty($item['description'])) { ?>
<div class="carousel-caption d-none d-md-block">
<?php if (!empty($item['title'])) { ?>
<h5><?php echo $item['title']; ?></h5>
<?php } ?>
<?php if (!empty($item['description'])) { ?>
<p><?php echo $item['description']; ?></p>
<?php } ?>
</div>
<?php } ?>
</div>
<?php
$active = false;
}
?>
</div>
<?php if ($hasItems && !empty($params->get('astroid_article_gallery_navigation', 1))) { ?>
<button class="carousel-control-prev" type="button" data-bs-target="#article-gallery" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden"><?php echo Text::_('JPREVIOUS'); ?></span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#article-gallery" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden"><?php echo Text::_('JNEXT'); ?></span>
</button>
<?php } ?>
</div>