start_controls_section( 'section_map', [ 'label' => __( 'Map', 'elementor' ), ] ); $default_address = __( 'London Eye, London, United Kingdom', 'elementor' ); $this->add_control( 'address', [ 'label' => __( 'Address', 'elementor' ), 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, 'categories' => [ TagsModule::POST_META_CATEGORY, ], ], 'placeholder' => $default_address, 'default' => $default_address, 'label_block' => true, ] ); $this->add_control( 'zoom', [ 'label' => __( 'Zoom', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 10, ], 'range' => [ 'px' => [ 'min' => 1, 'max' => 20, ], ], 'separator' => 'before', ] ); $this->add_responsive_control( 'height', [ 'label' => __( 'Height', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 40, 'max' => 1440, ], ], 'selectors' => [ '{{WRAPPER}} iframe' => 'height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_control( 'prevent_scroll', [ 'label' => __( 'Prevent Scroll', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'selectors' => [ '{{WRAPPER}} iframe' => 'pointer-events: none;', ], ] ); $this->add_control( 'view', [ 'label' => __( 'View', 'elementor' ), 'type' => Controls_Manager::HIDDEN, 'default' => 'traditional', ] ); $this->end_controls_section(); $this->start_controls_section( 'section_map_style', [ 'label' => __( 'Map', 'elementor' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->start_controls_tabs( 'map_filter' ); $this->start_controls_tab( 'normal', [ 'label' => __( 'Normal', 'elementor' ), ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'css_filters', 'selector' => '{{WRAPPER}} iframe', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'hover', [ 'label' => __( 'Hover', 'elementor' ), ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'css_filters_hover', 'selector' => '{{WRAPPER}}:hover iframe', ] ); $this->add_control( 'hover_transition', [ 'label' => __( 'Transition Duration', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 3, 'step' => 0.1, ], ], 'selectors' => [ '{{WRAPPER}} iframe' => 'transition-duration: {{SIZE}}s', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); } /** * Render google maps widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); if ( empty( $settings['address'] ) ) { return; } if ( 0 === absint( $settings['zoom']['size'] ) ) { $settings['zoom']['size'] = 10; } printf( '
', rawurlencode( $settings['address'] ), absint( $settings['zoom']['size'] ), esc_attr( $settings['address'] ) ); } /** * Render google maps widget output in the editor. * * Written as a Backbone JavaScript template and used to generate the live preview. * * @since 1.0.0 * @access protected */ protected function _content_template() {} }