start_controls_section( 'general', [ 'label' => __('General', 'wts-eae') ] ); $map_key = get_option('wts_eae_gmap_key'); if(!isset($map_key) || $map_key == ''){ $this->add_control( 'notice', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => '
Click Here to add google map api key.
' ] ); } $repeater = new Repeater(); $repeater->add_control( 'lat', [ 'label' => __('Latitude', 'wts-eae'), 'type' => Controls_Manager::TEXT, 'placeholder' => __('Enter latitude value here', 'wts-eae') ] ); $repeater->add_control( 'long', [ 'label' => __('Longitude', 'wts-eae'), 'type' => Controls_Manager::TEXT, 'placeholder' => __('Enter latitude value here', 'wts-eae') ] ); $repeater->add_control( 'address', [ 'label' => __('Address', 'wts-eae'), 'type' => Controls_Manager::WYSIWYG, 'placeholder' => __('Enter address', 'wts-eae') ] ); $repeater->add_control( 'icon', [ 'label' => __('Icon', 'wts-eae'), 'type' => Controls_Manager::MEDIA ] ); $repeater->add_control( 'icon_size', [ 'label' => __('Icon Size', 'wts-eae'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 20, 'max' => 200, ], ], 'default' => [ 'size' => 50, 'unit' => 'px', ] ] ); $repeater->add_control( 'info_window_onload', [ 'label' => __('Info Window On Load' , 'wts-eae'), 'type' => Controls_Manager::SWITCHER, 'default' => 'no', 'label_on' => __( 'Open', 'wts-eae' ), 'label_off' => __( 'Close', 'wts-eae' ), 'return_value' => 'yes', ] ); $this->add_control('markers', [ 'label' => __('Markers', 'wts-eae'), 'type' => Controls_Manager::REPEATER, 'fields' => array_values($repeater->get_controls()), 'default' => [ [ 'lat' => '28.612912', 'long' => '77.229510', 'address' => __('Put Address Here', 'wts-eae') ] ] ] ); $this->add_responsive_control( 'height', [ 'label' => __('Height','wts-eae'), 'type' => Controls_Manager::NUMBER, 'default' => 200, 'selectors' => [ '{{WRAPPER}} .eae-markers' => 'height:{{VALUE}}px' ] ] ); $this->add_control( 'zoom', [ 'label' => __('Zoom','wts-eae'), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 6, 'max' => 20, ] ], 'default' => [ 'unit' => 'px', 'size' => 10, ], ] ); $this->add_control( 'animate', [ 'label' => __('Animate Marker' , 'wts-eae'), 'type' => Controls_Manager::SWITCHER, 'default' => '', 'label_on' => __( 'Yes', 'wts-eae' ), 'label_off' => __( 'No', 'wts-eae' ), 'return_value' => 'yes', ] ); $this->add_control( 'snazzy_style', [ 'label' => __( 'Snazzy Style', 'wts-eae' ), 'type' => Controls_Manager::TEXTAREA, 'description' => __('Add style from Snazzy Maps. Copy and Paste style array from here -> Snazzy Maps') ] ); $this->end_controls_section(); } protected function render( ) { $settings = $this->get_settings(); $markers = $settings['markers']; $this->add_render_attribute('wrapper', 'data-zoom', $settings['zoom']['size']); $this->add_render_attribute('wrapper', 'data-style', $settings['snazzy_style']); $this->add_render_attribute('wrapper' , 'data-animate' , 'animate-'.$settings['animate']); //$this->add_render_attribute('wrapper' , 'data-show-info-window-onload' , $settings['open_info_window_onload']); if(count($markers)){ ?>
get_render_attribute_string('wrapper'); ?>>
widgets_manager->register_widget_type( new Widget_TextSeparator() );