$image[0], 'width' => $image[1], 'height' => $image[2],
'srcset' => wp_get_attachment_image_srcset($id, $size) ?: '',
'alt' => (string) get_post_meta($id, '_wp_attachment_image_alt', true),
];
}
}
$url = esc_url_raw((string) ($value['url'] ?? ''), ['http', 'https']);
return $url ? ['url' => $url, 'width' => 0, 'height' => 0, 'srcset' => '', 'alt' => ''] : [];
}
function image(array $item, array $settings, bool $first): string {
$size = option($settings['image_size'] ?? '', ['medium_large', 'large', 'full'], 'large');
$desktop = media($item['image'] ?? [], $size);
$mobile = media($item['mobile_image'] ?? [], $size);
if ( ! $desktop ) { $desktop = $mobile; }
if ( ! $desktop ) { return ''; }
$priority = $first && 'yes' === ($settings['hero_priority'] ?? '');
$prefix = $first ? '' : 'data-';
$alt = 'yes' === ($item['decorative'] ?? 'yes') ? '' : (trim((string) ($item['image_alt'] ?? '')) ?: $desktop['alt']);
$breakpoint = 767.98;
if ( class_exists('\\Elementor\\Plugin') && isset(\Elementor\Plugin::instance()->breakpoints) ) {
$points = \Elementor\Plugin::instance()->breakpoints->get_active_breakpoints();
if ( isset($points['mobile']) ) { $breakpoint = (float) $points['mobile']->get_value() + 0.98; }
}
$html = '
' . esc_html__('AGY Slider: Add a slide.', 'agy-slider') . '
' : ''; } $id = wp_unique_id('ags-'); $count = count($items); $navigation = option($settings['navigation'] ?? '', ['both', 'arrows', 'dots', 'none'], 'both'); $autoplay = ! $editor && 'yes' === ($settings['autoplay'] ?? '') && $count > 1; $config = [ 'autoplay' => $autoplay, 'interval' => number($settings['interval'] ?? null, 3000, 30000, 6000), 'duration' => number($settings['duration'] ?? null, 0, 1600, 450), 'loop' => 'yes' === ($settings['loop'] ?? 'yes'), 'effect' => option($settings['effect'] ?? '', ['fade', 'slide', 'scale'], 'fade'), 'swipe' => 'yes' === ($settings['swipe'] ?? 'yes'), 'editor' => $editor, 'playLabel' => __('Play slides automatically', 'agy-slider'), 'pauseLabel' => __('Pause autoplay', 'agy-slider'), 'reducedMotionLabel' => __('Reduced motion is enabled; autoplay is off.', 'agy-slider'), ]; $label = trim(wp_strip_all_tags((string) ($settings['accessible_label'] ?? ''))); if ( '' === $label ) { $label = __('Featured content', 'agy-slider'); } $html = '