common_parameters = [ 'fx' => 'slide', // Splide effects: fade and slide 'timeout' => !empty($photonic_slideshow_interval) && is_numeric($photonic_slideshow_interval) ? $photonic_slideshow_interval : 5000, // Time between slides in ms 'speed' => 1000, // Time for each transition 'pause' => true, // Pause on hover 'strip-style' => 'thumbs', 'controls' => 'show', ]; parent::__construct(); } public function generate_level_1_gallery(Photo_List $photo_list, array $short_code, Base $module): string { $photos = $photo_list->photos; if (empty($photos)) { return ''; } $short_code = array_merge($this->common_parameters, $short_code); global $photonic_wp_slide_adjustment, $photonic_slideshow_interval; $style = esc_attr(empty($short_code['style']) ? (empty($short_code['layout']) ? '' : $short_code['layout']) : $short_code['style']); $title_position = esc_attr(empty($short_code['title_position']) ? $photo_list->title_position : $short_code['title_position']); global $photonic_slideshow_prevent_autostart; if ('wp' === $module->provider) { $pager_position = !empty($short_code['style']) ? $short_code['style'] : $short_code['layout']; } else { $pager_position = $short_code['layout']; } $pager_position = esc_attr($pager_position); $perPage = (empty($short_code['columns']) || 'auto' === $short_code['columns'] || !is_numeric($short_code['columns'])) ? 1 : $short_code['columns']; $splide_options = [ 'type' => (!empty($short_code['fx']) && 'fade' === $short_code['fx']) ? 'fade' : 'loop', 'perPage' => esc_attr($perPage), 'autoplay' => !(isset($photonic_slideshow_prevent_autostart) && 'on' === $photonic_slideshow_prevent_autostart), 'interval' => esc_attr((empty($short_code['timeout']) || !is_numeric($short_code['timeout'])) ? (empty($photonic_slideshow_interval) || !is_numeric($photonic_slideshow_interval) ? 5000 : $photonic_slideshow_interval) : $short_code['timeout']), 'speed' => esc_attr((empty($short_code['speed']) || !is_numeric($short_code['speed'])) ? 1000 : $short_code['speed']), 'drag' => true, 'pauseOnHover' => !(0 === $short_code['pause'] || '0' === $short_code['pause']), 'pagination' => ('strip-below' === $pager_position || 'strip-right' === $pager_position) && 'button' === $short_code['strip-style'], 'slideFocus' => false, // 'updateOnMove' => true, 'arrows' => empty($short_code['controls']) || 'hide' !== $short_code['controls'], // 'cover' => $photonic_wp_slide_adjustment !== 'side-white' && $photonic_wp_slide_adjustment !== 'adapt-height', // 'heightRatio' => ($photonic_wp_slide_adjustment !== 'side-white' && $photonic_wp_slide_adjustment !== 'adapt-height') ? 0.5 : 0, 'direction' => 'ltr', 'breakpoints' => [ 480 => [ 'perPage' => 1, ] ], ]; $splide_options = esc_attr(wp_json_encode($splide_options)); $ret = ''; if ('strip-above' === $pager_position && 'thumbs' === $short_code['strip-style']) { // $ret .= $this->get_thumbnails($photos, $module); $ret .= $this->get_secondary_slider($photos, $module); } $ret .= "
\n"; $ret .= "\t
\n"; // $ret .= "\t\t
\n"; $ret .= "
\n"; if (('strip-below' === $pager_position || 'strip-right' === $pager_position) && 'thumbs' === $short_code['strip-style']) { $ret .= $this->get_secondary_slider($photos, $module); } return $ret; } /** * @param array $photos * @param Base $module * @return string */ private function get_secondary_slider(array $photos, Base $module): string { $thumb_options = [ 'fixedWidth' => 100, 'height' => 60, 'gap' => 10, 'cover' => true, 'isNavigation' => true, 'pagination' => false, 'arrows' => false, // 'focus' => 'center', 'breakpoints' => [ '600' => [ 'fixedWidth' => 66, 'height' => 40, ], ], ]; $thumb_options = esc_attr(wp_json_encode($thumb_options)); $ret = "
\n"; $ret .= "\t
\n"; $ret .= "\t\n"; $ret .= "\t
\n"; $ret .= "
\n"; return $ret; } }