slider | search overlay (before + form + after) | cards * * @package AKSRT * @version 4.2.0 */ defined('ABSPATH') || exit; // Visibility (page type + device) is decided by aksrt_header_slide_is_show(). // This partial only renders content when already gated by aksrt_header_slide(). $cfg = get_query_var('aksrt_module_config', []); if (!is_array($cfg)) { $cfg = []; } $hero_banners = function_exists('aksrt_get_banners') ? aksrt_get_banners(8, 'hero') : []; $settings = function_exists('aksrt_get_all_settings') ? aksrt_get_all_settings() : []; $search_cfg = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::get_header_components_search_config() : [ 'show' => false, 'keywords' => [], 'categories' => [], 'type_options' => [], 'before_html' => '', 'after_html' => '', 'show_input_cat' => false, 'show_type' => false, ]; $show_search = !empty($search_cfg['show']) || !empty($cfg['with_search']); $show_cards = !empty($settings['header_components_cards_enabled']); $icon_cards = isset($settings['header_components_icon_cards']) ? (array) $settings['header_components_icon_cards'] : []; $card_bg_mode = !empty($settings['header_components_card_shared_bg']) ? 'shared' : 'individual'; $card_blur = !empty($settings['header_components_card_blur']); $filter_blur_devices = isset($settings['header_components_filter_blur_devices']) ? (array) $settings['header_components_filter_blur_devices'] : ($card_blur ? ['pc', 'mobile'] : []); $card_show_devices = isset($settings['header_components_card_show_devices']) ? (array) $settings['header_components_card_show_devices'] : ['pc', 'mobile']; $card_icon_shape = $settings['header_components_card_icon_shape'] ?? 'circle'; $slide_count = count($hero_banners); $visible_card_count = ($show_cards && !empty($icon_cards)) ? count($icon_cards) : 0; $container_classes = ['header-slider-container', 'header-components-container', 'relative', 'mb20', 'card-' . $visible_card_count]; if (in_array('pc', $filter_blur_devices, true) || in_array('mobile', $filter_blur_devices, true)) { $container_classes[] = 'filter-blur'; } if (in_array('pc', $filter_blur_devices, true)) { $container_classes[] = 'has-blur-pc'; } if (in_array('mobile', $filter_blur_devices, true)) { $container_classes[] = 'has-blur-mobile'; } if (!in_array('pc', $card_show_devices, true)) { $container_classes[] = 'hide-cards-pc'; } if (!in_array('mobile', $card_show_devices, true)) { $container_classes[] = 'hide-cards-mobile'; } $search_placeholder = function_exists('aksrt_get_search_placeholder') ? aksrt_get_search_placeholder() : __('开启精彩搜索', 'aksrt'); $search_value = trim((string) get_search_query()); $search_type = function_exists('aksrt_get_search_form_type') ? aksrt_get_search_form_type() : 'post'; /** * Search overlay = zibll .header-slider-search.abs-center * Title/subtitle live in before_html (same flow stack as the form). */ $render_hero_search = static function (string $search_id) use ($search_placeholder, $search_value, $search_type, $search_cfg): void { $_kw = $search_cfg['keywords'] ?? []; $_cats = $search_cfg['categories'] ?? []; $_types = $search_cfg['type_options'] ?? []; $_show_cat = !empty($search_cfg['show_input_cat']) && !empty($_cats); $_show_type = !empty($search_cfg['show_type']) && !empty($_types); $_before = isset($search_cfg['before_html']) ? (string) $search_cfg['before_html'] : ''; $_after = isset($search_cfg['after_html']) ? (string) $search_cfg['after_html'] : ''; ?>
.header.show-slide{--header-color:' . esc_attr($_nav_color_for_header) . ';}'; } $swiper_config = [ 'effect' => $slider_cfg['effect'] ?? 'fade', 'loop' => $slide_count > 1 && ($slider_cfg['loop'] ?? true), 'speed' => 600, 'autoplay' => $slide_count > 1 ? ['delay' => ($slider_cfg['autoplay_interval'] ?? 5000), 'disableOnInteraction' => false] : false, 'keyboard' => ['enabled' => true], ]; if (!empty($slider_cfg['pagination'])) { $swiper_config['pagination'] = ['clickable' => true]; } if (!empty($slider_cfg['navigation'])) { $swiper_config['navigation'] = true; } $pc_height = $slider_cfg['pc_height'] ?? ''; $mobile_height = $slider_cfg['mobile_height'] ?? ''; $height_style = ''; if ($pc_height !== '') { $height_style .= '--pc-height:' . esc_attr($pc_height) . ';'; } if ($mobile_height !== '') { $height_style .= '--m-height:' . esc_attr($mobile_height) . ';'; } ?>