PluginProbe
Photonic Gallery & Lightbox for Flickr, SmugMug & Others / 3.37
Photonic Gallery & Lightbox for Flickr, SmugMug & Others v3.37
3.37 3.36 3.35 3.34 3.33 2.19 2.20 2.21 2.22 2.23 2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.34 2.40 2.41 2.42 2.43 All 142 releases
← All changes | Lightboxes/Lightgallery.php +30 -6 2.43 → 3.37 View file →
@@ -1,9 +1,13 @@
1 1 <?php
2 +
2 3 namespace Photonic_Plugin\Lightboxes;
3 4
4 -require_once('Lightbox.php');
5 +use Photonic_Plugin\Components\Photo;
6 +use Photonic_Plugin\Platforms\Base;
5 7
8 +require_once 'Lightbox.php';
9 +
6 10 class Lightgallery extends Lightbox {
7 11 protected function __construct() {
8 12 $this->library = 'lightgallery';
9 13 parent::__construct();
@@ -8,10 +12,30 @@
8 12 $this->library = 'lightgallery';
9 13 parent::__construct();
10 14 }
11 15
12 - function get_photo_attributes($photo_data, $module) {
13 - $download = !empty($photo_data['download']) ? 'data-download-url="'.$photo_data['download'].'" ' : '';
14 - $video = !empty($photo_data['video']) ? ' data-html="#photonic-video-'.$module->provider.'-'.$module->gallery_index.'-'.$photo_data['id'].'" ' : '';
15 - return ' data-sub-html="'.$photo_data['title'].'" '.$video.$download;
16 + public function get_photo_attributes(array $photo_data, Base $module): array {
17 + $out = parent::get_photo_attributes($photo_data, $module);
18 + if (!empty($photo_data['download'])) {
19 + $out['data-download-url'] = $photo_data['download'];
20 + }
21 +
22 + if (!empty($photo_data['video'])) {
23 + $out['data-video'] = esc_attr('{"source": [{"src": "' . $photo_data['video'] . '", "type": "video/mp4"}], "attributes": {"preload": false, "playsinline": true, "controls": true}}');
24 + }
25 +
26 + $out['data-sub-html'] = $photo_data['title'];
27 + $out['data-photonic-thumb'] = $photo_data['thumbnail'];
28 +
29 + return $out;
16 30 }
17 -}
31 +
32 + /**
33 + * {@inheritDoc}
34 + */
35 + public function get_grid_link(Photo $photo, array $short_code, Base $module): string {
36 + if (!empty($photo->video)) {
37 + return '';
38 + }
39 + return parent::get_grid_link($photo, $short_code, $module);
40 + }
41 +}