start_controls_section( 'content_section', array( 'label' => __( 'Content', 'a1-tools' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ) ); $this->add_control( 'map_height', array( 'label' => __( 'Map Height', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 200, 'max' => 800, ), ), 'default' => array( 'size' => 400, 'unit' => 'px', ), ) ); $this->add_control( 'show_search', array( 'label' => __( 'Show Search Bar', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => __( 'Yes', 'a1-tools' ), 'label_off' => __( 'No', 'a1-tools' ), 'return_value' => 'yes', 'default' => 'yes', ) ); $this->add_control( 'show_filters', array( 'label' => __( 'Show State Filter', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => __( 'Yes', 'a1-tools' ), 'label_off' => __( 'No', 'a1-tools' ), 'return_value' => 'yes', 'default' => 'yes', ) ); $this->add_control( 'show_images', array( 'label' => __( 'Show Store Images', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => __( 'Yes', 'a1-tools' ), 'label_off' => __( 'No', 'a1-tools' ), 'return_value' => 'yes', 'default' => 'yes', ) ); $this->add_control( 'marker_icon', array( 'label' => __( 'Custom Marker Icon URL', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => '', 'placeholder' => __( 'Uses plugin settings or default pin', 'a1-tools' ), 'description' => __( 'URL to a custom map marker image (PNG, ~50x50px). Leave empty to use Plugin Settings value.', 'a1-tools' ), 'label_block' => true, ) ); $this->add_control( 'api_key', array( 'label' => __( 'Google Maps API Key', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => '', 'placeholder' => __( 'Uses plugin settings value', 'a1-tools' ), 'description' => __( 'Override the Google Maps API key for this widget. Leave empty to use Plugin Settings value.', 'a1-tools' ), 'label_block' => true, ) ); $this->end_controls_section(); // ── Style: Store Cards ────────────────────────────────────── $this->start_controls_section( 'style_cards_section', array( 'label' => __( 'Store Cards', 'a1-tools' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ) ); $this->add_control( 'card_bg_color', array( 'label' => __( 'Background Color', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => array( '{{WRAPPER}} .a1tools-sl-card' => 'background-color: {{VALUE}};', ), ) ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), array( 'name' => 'card_border', 'selector' => '{{WRAPPER}} .a1tools-sl-card', ) ); $this->add_control( 'card_border_hover_color', array( 'label' => __( 'Border Hover Color', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} .a1tools-sl-card:hover' => 'border-color: {{VALUE}};', '{{WRAPPER}} .a1tools-sl-card.active' => 'border-color: {{VALUE}};', ), 'condition' => array( 'card_border_border!' => '' ), ) ); $this->add_control( 'card_border_radius', array( 'label' => __( 'Border Radius', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', '%' ), 'default' => array( 'top' => '8', 'right' => '8', 'bottom' => '8', 'left' => '8', 'unit' => 'px', ), 'selectors' => array( '{{WRAPPER}} .a1tools-sl-card' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ) ); $this->add_responsive_control( 'card_padding', array( 'label' => __( 'Padding', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => array( 'px', 'em' ), 'default' => array( 'top' => '16', 'right' => '16', 'bottom' => '16', 'left' => '16', 'unit' => 'px', ), 'selectors' => array( '{{WRAPPER}} .a1tools-sl-card' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ), ) ); $this->add_group_control( \Elementor\Group_Control_Box_Shadow::get_type(), array( 'name' => 'card_shadow', 'selector' => '{{WRAPPER}} .a1tools-sl-card', ) ); $this->add_control( 'card_hover_shadow_heading', array( 'label' => __( 'Hover Shadow', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ) ); $this->add_group_control( \Elementor\Group_Control_Box_Shadow::get_type(), array( 'name' => 'card_hover_shadow', 'selector' => '{{WRAPPER}} .a1tools-sl-card:hover, {{WRAPPER}} .a1tools-sl-card.active', ) ); $this->add_responsive_control( 'card_spacing', array( 'label' => __( 'Card Spacing', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'separator' => 'before', 'range' => array( 'px' => array( 'min' => 0, 'max' => 40, ), ), 'default' => array( 'size' => 12, 'unit' => 'px', ), 'selectors' => array( '{{WRAPPER}} .a1tools-sl-card' => 'margin-bottom: {{SIZE}}{{UNIT}};', ), ) ); $this->end_controls_section(); // ── Style: Typography ─────────────────────────────────────── $this->start_controls_section( 'style_typography_section', array( 'label' => __( 'Typography', 'a1-tools' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ) ); $this->add_control( 'name_heading', array( 'label' => __( 'Store Name', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::HEADING, ) ); $this->add_control( 'card_text_color', array( 'label' => __( 'Color', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#333333', 'selectors' => array( '{{WRAPPER}} .a1tools-sl-card-name' => 'color: {{VALUE}};', ), ) ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), array( 'name' => 'name_typography', 'selector' => '{{WRAPPER}} .a1tools-sl-card-name', ) ); $this->add_control( 'address_heading', array( 'label' => __( 'Address / Details', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ) ); $this->add_control( 'card_detail_color', array( 'label' => __( 'Color', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#666666', 'selectors' => array( '{{WRAPPER}} .a1tools-sl-card-address' => 'color: {{VALUE}};', '{{WRAPPER}} .a1tools-sl-card' => 'color: {{VALUE}};', ), ) ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), array( 'name' => 'detail_typography', 'selector' => '{{WRAPPER}} .a1tools-sl-card-address, {{WRAPPER}} .a1tools-sl-card-phone, {{WRAPPER}} .a1tools-sl-card-email', ) ); $this->add_control( 'link_heading', array( 'label' => __( 'Links / Phone', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ) ); $this->add_control( 'card_accent_color', array( 'label' => __( 'Color', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#0066cc', 'selectors' => array( '{{WRAPPER}} .a1tools-sl-card-links a' => 'color: {{VALUE}};', '{{WRAPPER}} .a1tools-sl-card-phone a' => 'color: {{VALUE}};', '{{WRAPPER}} .a1tools-sl-card-email a' => 'color: {{VALUE}};', ), ) ); $this->add_control( 'card_accent_hover_color', array( 'label' => __( 'Hover Color', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} .a1tools-sl-card-links a:hover' => 'color: {{VALUE}};', '{{WRAPPER}} .a1tools-sl-card-phone a:hover' => 'color: {{VALUE}};', '{{WRAPPER}} .a1tools-sl-card-email a:hover' => 'color: {{VALUE}};', ), ) ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), array( 'name' => 'link_typography', 'selector' => '{{WRAPPER}} .a1tools-sl-card-links a, {{WRAPPER}} .a1tools-sl-card-phone a, {{WRAPPER}} .a1tools-sl-card-email a', ) ); $this->end_controls_section(); // ── Style: Search & Filters ───────────────────────────────── $this->start_controls_section( 'style_controls_section', array( 'label' => __( 'Search & Filters', 'a1-tools' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ) ); $this->add_control( 'search_bg_color', array( 'label' => __( 'Background Color', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => array( '{{WRAPPER}} .a1tools-sl-search' => 'background-color: {{VALUE}};', '{{WRAPPER}} .a1tools-sl-state-filter' => 'background-color: {{VALUE}};', ), ) ); $this->add_control( 'search_text_color', array( 'label' => __( 'Text Color', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#333333', 'selectors' => array( '{{WRAPPER}} .a1tools-sl-search' => 'color: {{VALUE}};', '{{WRAPPER}} .a1tools-sl-state-filter' => 'color: {{VALUE}};', ), ) ); $this->add_control( 'search_border_color', array( 'label' => __( 'Border Color', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#dddddd', 'selectors' => array( '{{WRAPPER}} .a1tools-sl-search' => 'border-color: {{VALUE}};', '{{WRAPPER}} .a1tools-sl-state-filter' => 'border-color: {{VALUE}};', ), ) ); $this->add_control( 'search_border_radius', array( 'label' => __( 'Border Radius', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 0, 'max' => 20, ), ), 'default' => array( 'size' => 6, 'unit' => 'px', ), 'selectors' => array( '{{WRAPPER}} .a1tools-sl-search' => 'border-radius: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .a1tools-sl-state-filter' => 'border-radius: {{SIZE}}{{UNIT}};', ), ) ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), array( 'name' => 'search_typography', 'selector' => '{{WRAPPER}} .a1tools-sl-search, {{WRAPPER}} .a1tools-sl-state-filter', ) ); $this->end_controls_section(); } // ──────────────────────────────────────────────────────────────── // Render // ──────────────────────────────────────────────────────────────── protected function render() { $settings = $this->get_settings_for_display(); echo a1tools_shortcode_store_locator( array( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 'map_height' => $settings['map_height']['size'] ?? '500', 'show_search' => $settings['show_search'] ?? 'yes', 'show_filters' => $settings['show_filters'] ?? 'yes', 'show_images' => $settings['show_images'] ?? 'yes', 'marker_icon' => $settings['marker_icon'] ?? '', 'api_key' => $settings['api_key'] ?? '', ) ); } protected function content_template() { ?>