start_controls_section( 'content_section', array( 'label' => __( 'Content', 'a1-tools' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ) ); $this->add_control( 'show_phone', array( 'label' => __( 'Show Phone', '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_map', array( 'label' => __( 'Show Map', '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_directions', array( 'label' => __( 'Show Directions Link', '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( 'map_height', array( 'label' => __( 'Map Height', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 150, 'max' => 600, ), ), 'default' => array( 'size' => 300, 'unit' => 'px', ), 'condition' => array( 'show_map' => 'yes', ), ) ); $this->add_control( 'map_zoom', array( 'label' => __( 'Map Zoom Level', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::NUMBER, 'min' => 1, 'max' => 20, 'default' => 15, 'condition' => array( 'show_map' => 'yes', ), ) ); $this->end_controls_section(); // ── Style: Card ───────────────────────────────────────────── $this->start_controls_section( 'style_card_section', array( 'label' => __( 'Card', 'a1-tools' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ) ); $this->add_control( 'card_background', array( 'label' => __( 'Background Color', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => array( '{{WRAPPER}} .a1tools-franchise-card' => 'background-color: {{VALUE}};', ), ) ); $this->add_control( 'card_border_radius', array( 'label' => __( 'Border Radius', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => array( 'px' => array( 'min' => 0, 'max' => 30, ), ), 'default' => array( 'size' => 8, 'unit' => 'px', ), 'selectors' => array( '{{WRAPPER}} .a1tools-franchise-card' => 'border-radius: {{SIZE}}{{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' => '20', 'right' => '20', 'bottom' => '20', 'left' => '20', 'unit' => 'px', ), 'selectors' => array( '{{WRAPPER}} .a1tools-franchise-card' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{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( 'title_color', array( 'label' => __( 'Title Color', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#333333', 'selectors' => array( '{{WRAPPER}} .a1tools-franchise-title' => 'color: {{VALUE}};', ), ) ); $this->add_control( 'phone_color', array( 'label' => __( 'Phone Color', 'a1-tools' ), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#0066cc', 'selectors' => array( '{{WRAPPER}} .a1tools-franchise-phone a' => 'color: {{VALUE}};', ), ) ); $this->end_controls_section(); } // ──────────────────────────────────────────────────────────────── // Render // ──────────────────────────────────────────────────────────────── protected function render() { $settings = $this->get_settings_for_display(); echo a1tools_shortcode_franchise( array( 'show_phone' => $settings['show_phone'] ?? 'yes', 'show_map' => $settings['show_map'] ?? 'yes', 'show_directions' => $settings['show_directions'] ?? 'yes', 'map_height' => $settings['map_height']['size'] ?? '300', 'map_zoom' => $settings['map_zoom'] ?? '15', ) ); } protected function content_template() { ?>

<# if ( settings.show_phone === 'yes' ) { #>
(555) 123-4567
<# } #> <# if ( settings.show_map === 'yes' ) { #>
Map loads on frontend
<# } #> <# if ( settings.show_directions === 'yes' ) { #>
Get Directions
<# } #>