| @@ -40,9 +40,9 @@ | ||
| 40 | 40 | * |
| 41 | 41 | * @return string Widget title. |
| 42 | 42 | */ |
| 43 | 43 | public function get_title() { |
| 44 | - return esc_html__( 'Google Maps', 'elementor' ); | |
| 44 | + return __( 'Google Maps', 'elementor' ); | |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Get widget icon. |
| @@ -87,31 +87,9 @@ | ||
| 87 | 87 | public function get_keywords() { |
| 88 | 88 | return [ 'google', 'map', 'embed', 'location' ]; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - protected function is_dynamic_content(): bool { | |
| 92 | - return false; | |
| 93 | - } | |
| 94 | - | |
| 95 | 91 | /** |
| 96 | - * Get style dependencies. | |
| 97 | - * | |
| 98 | - * Retrieve the list of style dependencies the widget requires. | |
| 99 | - * | |
| 100 | - * @since 3.24.0 | |
| 101 | - * @access public | |
| 102 | - * | |
| 103 | - * @return array Widget style dependencies. | |
| 104 | - */ | |
| 105 | - public function get_style_depends(): array { | |
| 106 | - return [ 'widget-google_maps' ]; | |
| 107 | - } | |
| 108 | - | |
| 109 | - public function has_widget_inner_wrapper(): bool { | |
| 110 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 111 | - } | |
| 112 | - | |
| 113 | - /** | |
| 114 | 92 | * Register google maps widget controls. |
| 115 | 93 | * |
| 116 | 94 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 117 | 95 | * |
| @@ -121,9 +99,9 @@ | ||
| 121 | 99 | protected function register_controls() { |
| 122 | 100 | $this->start_controls_section( |
| 123 | 101 | 'section_map', |
| 124 | 102 | [ |
| 125 | - 'label' => esc_html__( 'Google Maps', 'elementor' ), | |
| 103 | + 'label' => __( 'Map', 'elementor' ), | |
| 126 | 104 | ] |
| 127 | 105 | ); |
| 128 | 106 | |
| 129 | 107 | if ( Plugin::$instance->editor->is_edit_mode() ) { |
| @@ -132,27 +110,25 @@ | ||
| 132 | 110 | if ( ! $api_key ) { |
| 133 | 111 | $this->add_control( |
| 134 | 112 | 'api_key_notification', |
| 135 | 113 | [ |
| 136 | - 'type' => Controls_Manager::ALERT, | |
| 137 | - 'alert_type' => 'info', | |
| 138 | - 'content' => sprintf( | |
| 139 | - /* translators: 1: Integration settings link open tag, 2: Create API key link open tag, 3: Link close tag. */ | |
| 140 | - esc_html__( 'Set your Google Maps API Key in Elementor\'s %1$sIntegrations Settings%3$s page. Create your key %2$shere.%3$s', 'elementor' ), | |
| 141 | - '<a href="' . Settings::get_settings_tab_url( 'integrations' ) . '" target="_blank">', | |
| 142 | - '<a href="https://developers.google.com/maps/documentation/embed/get-api-key" target="_blank">', | |
| 143 | - '</a>' | |
| 114 | + 'type' => Controls_Manager::RAW_HTML, | |
| 115 | + 'raw' => sprintf( | |
| 116 | + __( 'Set your Google Maps API Key in Elementor\'s <a href="%1$s" target="_blank">Integrations Settings</a> page. Create your key <a href="%2$s" target="_blank">here.', 'elementor' ), | |
| 117 | + Settings::get_url() . '#tab-integrations', | |
| 118 | + 'https://developers.google.com/maps/documentation/embed/get-api-key' | |
| 144 | 119 | ), |
| 120 | + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', | |
| 145 | 121 | ] |
| 146 | 122 | ); |
| 147 | 123 | } |
| 148 | 124 | } |
| 149 | 125 | |
| 150 | - $default_address = esc_html__( 'London Eye, London, United Kingdom', 'elementor' ); | |
| 126 | + $default_address = __( 'London Eye, London, United Kingdom', 'elementor' ); | |
| 151 | 127 | $this->add_control( |
| 152 | 128 | 'address', |
| 153 | 129 | [ |
| 154 | - 'label' => esc_html__( 'Location', 'elementor' ), | |
| 130 | + 'label' => __( 'Location', 'elementor' ), | |
| 155 | 131 | 'type' => Controls_Manager::TEXT, |
| 156 | 132 | 'dynamic' => [ |
| 157 | 133 | 'active' => true, |
| 158 | 134 | 'categories' => [ |
| @@ -158,11 +134,8 @@ | ||
| 158 | 134 | 'categories' => [ |
| 159 | 135 | TagsModule::POST_META_CATEGORY, |
| 160 | 136 | ], |
| 161 | 137 | ], |
| 162 | - 'ai' => [ | |
| 163 | - 'active' => false, | |
| 164 | - ], | |
| 165 | 138 | 'placeholder' => $default_address, |
| 166 | 139 | 'default' => $default_address, |
| 167 | 140 | 'label_block' => true, |
| 168 | 141 | ] |
| @@ -170,9 +143,9 @@ | ||
| 170 | 143 | |
| 171 | 144 | $this->add_control( |
| 172 | 145 | 'zoom', |
| 173 | 146 | [ |
| 174 | - 'label' => esc_html__( 'Zoom', 'elementor' ), | |
| 147 | + 'label' => __( 'Zoom', 'elementor' ), | |
| 175 | 148 | 'type' => Controls_Manager::SLIDER, |
| 176 | 149 | 'default' => [ |
| 177 | 150 | 'size' => 10, |
| 178 | 151 | ], |
| @@ -188,9 +161,9 @@ | ||
| 188 | 161 | |
| 189 | 162 | $this->add_responsive_control( |
| 190 | 163 | 'height', |
| 191 | 164 | [ |
| 192 | - 'label' => esc_html__( 'Height', 'elementor' ), | |
| 165 | + 'label' => __( 'Height', 'elementor' ), | |
| 193 | 166 | 'type' => Controls_Manager::SLIDER, |
| 194 | 167 | 'range' => [ |
| 195 | 168 | 'px' => [ |
| 196 | 169 | 'min' => 40, |
| @@ -195,10 +168,14 @@ | ||
| 195 | 168 | 'px' => [ |
| 196 | 169 | 'min' => 40, |
| 197 | 170 | 'max' => 1440, |
| 198 | 171 | ], |
| 172 | + 'vh' => [ | |
| 173 | + 'min' => 0, | |
| 174 | + 'max' => 100, | |
| 175 | + ], | |
| 199 | 176 | ], |
| 200 | - 'size_units' => [ 'px', 'em', 'rem', 'vh', 'custom' ], | |
| 177 | + 'size_units' => [ 'px', 'vh' ], | |
| 201 | 178 | 'selectors' => [ |
| 202 | 179 | '{{WRAPPER}} iframe' => 'height: {{SIZE}}{{UNIT}};', |
| 203 | 180 | ], |
| 204 | 181 | ] |
| @@ -203,14 +180,23 @@ | ||
| 203 | 180 | ], |
| 204 | 181 | ] |
| 205 | 182 | ); |
| 206 | 183 | |
| 184 | + $this->add_control( | |
| 185 | + 'view', | |
| 186 | + [ | |
| 187 | + 'label' => __( 'View', 'elementor' ), | |
| 188 | + 'type' => Controls_Manager::HIDDEN, | |
| 189 | + 'default' => 'traditional', | |
| 190 | + ] | |
| 191 | + ); | |
| 192 | + | |
| 207 | 193 | $this->end_controls_section(); |
| 208 | 194 | |
| 209 | 195 | $this->start_controls_section( |
| 210 | 196 | 'section_map_style', |
| 211 | 197 | [ |
| 212 | - 'label' => esc_html__( 'Google Maps', 'elementor' ), | |
| 198 | + 'label' => __( 'Map', 'elementor' ), | |
| 213 | 199 | 'tab' => Controls_Manager::TAB_STYLE, |
| 214 | 200 | ] |
| 215 | 201 | ); |
| 216 | 202 | |
| @@ -217,9 +203,9 @@ | ||
| 217 | 203 | $this->start_controls_tabs( 'map_filter' ); |
| 218 | 204 | |
| 219 | 205 | $this->start_controls_tab( 'normal', |
| 220 | 206 | [ |
| 221 | - 'label' => esc_html__( 'Normal', 'elementor' ), | |
| 207 | + 'label' => __( 'Normal', 'elementor' ), | |
| 222 | 208 | ] |
| 223 | 209 | ); |
| 224 | 210 | |
| 225 | 211 | $this->add_group_control( |
| @@ -233,9 +219,9 @@ | ||
| 233 | 219 | $this->end_controls_tab(); |
| 234 | 220 | |
| 235 | 221 | $this->start_controls_tab( 'hover', |
| 236 | 222 | [ |
| 237 | - 'label' => esc_html__( 'Hover', 'elementor' ), | |
| 223 | + 'label' => __( 'Hover', 'elementor' ), | |
| 238 | 224 | ] |
| 239 | 225 | ); |
| 240 | 226 | |
| 241 | 227 | $this->add_group_control( |
| @@ -248,13 +234,12 @@ | ||
| 248 | 234 | |
| 249 | 235 | $this->add_control( |
| 250 | 236 | 'hover_transition', |
| 251 | 237 | [ |
| 252 | - 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (s)', | |
| 238 | + 'label' => __( 'Transition Duration', 'elementor' ), | |
| 253 | 239 | 'type' => Controls_Manager::SLIDER, |
| 254 | 240 | 'range' => [ |
| 255 | 241 | 'px' => [ |
| 256 | - 'min' => 0, | |
| 257 | 242 | 'max' => 3, |
| 258 | 243 | 'step' => 0.1, |
| 259 | 244 | ], |
| 260 | 245 | ], |
| @@ -294,14 +279,15 @@ | ||
| 294 | 279 | |
| 295 | 280 | $params = [ |
| 296 | 281 | rawurlencode( $settings['address'] ), |
| 297 | 282 | absint( $settings['zoom']['size'] ), |
| 283 | + esc_attr( $settings['address'] ), | |
| 298 | 284 | ]; |
| 299 | 285 | |
| 300 | 286 | if ( $api_key ) { |
| 301 | 287 | $params[] = $api_key; |
| 302 | 288 | |
| 303 | - $url = 'https://www.google.com/maps/embed/v1/place?key=%3$s&q=%1$s&zoom=%2$d'; | |
| 289 | + $url = 'https://www.google.com/maps/embed/v1/place?key=%4$s&q=%1$s&zoom=%2$d'; | |
| 304 | 290 | } else { |
| 305 | 291 | $url = 'https://maps.google.com/maps?q=%1$s&t=m&z=%2$d&output=embed&iwloc=near'; |
| 306 | 292 | } |
| 307 | 293 | |
| @@ -306,13 +292,9 @@ | ||
| 306 | 292 | } |
| 307 | 293 | |
| 308 | 294 | ?> |
| 309 | 295 | <div class="elementor-custom-embed"> |
| 310 | - <iframe loading="lazy" | |
| 311 | - src="<?php echo esc_url( vsprintf( $url, $params ) ); ?>" | |
| 312 | - title="<?php echo esc_attr( $settings['address'] ); ?>" | |
| 313 | - aria-label="<?php echo esc_attr( $settings['address'] ); ?>" | |
| 314 | - ></iframe> | |
| 296 | + <iframe frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="<?php echo vsprintf( $url, $params ); ?>" title="%3$s" aria-label="%3$s"></iframe> | |
| 315 | 297 | </div> |
| 316 | 298 | <?php |
| 317 | 299 | } |
| 318 | 300 | |
| @@ -324,14 +306,5 @@ | ||
| 324 | 306 | * @since 2.9.0 |
| 325 | 307 | * @access protected |
| 326 | 308 | */ |
| 327 | 309 | protected function content_template() {} |
| 328 | - | |
| 329 | - public function render_markdown(): string { | |
| 330 | - $settings = $this->get_settings_for_display(); | |
| 331 | - $address = Utils::html_to_plain_text( $settings['address'] ?? '' ); | |
| 332 | - if ( empty( $address ) ) { | |
| 333 | - return ''; | |
| 334 | - } | |
| 335 | - return '[Map: ' . $address . '](https://maps.google.com/maps?q=' . rawurlencode( $address ) . ')'; | |
| 336 | - } | |
| 337 | 310 | } |