| @@ -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' => esc_html__( 'Map', 'elementor' ), | |
| 126 | 104 | ] |
| 127 | 105 | ); |
| 128 | 106 | |
| 129 | 107 | if ( Plugin::$instance->editor->is_edit_mode() ) { |
| @@ -132,17 +110,16 @@ | ||
| 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 | + /* translators: 1: Link to integrations settings tab, 2: Link to google maps api key documentation. */ | |
| 117 | + esc_html__( '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' ), | |
| 118 | + Settings::get_url() . '#tab-integrations', | |
| 119 | + 'https://developers.google.com/maps/documentation/embed/get-api-key' | |
| 144 | 120 | ), |
| 121 | + 'content_classes' => 'elementor-panel-alert elementor-panel-alert-info', | |
| 145 | 122 | ] |
| 146 | 123 | ); |
| 147 | 124 | } |
| 148 | 125 | } |
| @@ -158,11 +135,8 @@ | ||
| 158 | 135 | 'categories' => [ |
| 159 | 136 | TagsModule::POST_META_CATEGORY, |
| 160 | 137 | ], |
| 161 | 138 | ], |
| 162 | - 'ai' => [ | |
| 163 | - 'active' => false, | |
| 164 | - ], | |
| 165 | 139 | 'placeholder' => $default_address, |
| 166 | 140 | 'default' => $default_address, |
| 167 | 141 | 'label_block' => true, |
| 168 | 142 | ] |
| @@ -195,10 +169,14 @@ | ||
| 195 | 169 | 'px' => [ |
| 196 | 170 | 'min' => 40, |
| 197 | 171 | 'max' => 1440, |
| 198 | 172 | ], |
| 173 | + 'vh' => [ | |
| 174 | + 'min' => 0, | |
| 175 | + 'max' => 100, | |
| 176 | + ], | |
| 199 | 177 | ], |
| 200 | - 'size_units' => [ 'px', 'em', 'rem', 'vh', 'custom' ], | |
| 178 | + 'size_units' => [ 'px', 'vh' ], | |
| 201 | 179 | 'selectors' => [ |
| 202 | 180 | '{{WRAPPER}} iframe' => 'height: {{SIZE}}{{UNIT}};', |
| 203 | 181 | ], |
| 204 | 182 | ] |
| @@ -203,14 +181,23 @@ | ||
| 203 | 181 | ], |
| 204 | 182 | ] |
| 205 | 183 | ); |
| 206 | 184 | |
| 185 | + $this->add_control( | |
| 186 | + 'view', | |
| 187 | + [ | |
| 188 | + 'label' => esc_html__( 'View', 'elementor' ), | |
| 189 | + 'type' => Controls_Manager::HIDDEN, | |
| 190 | + 'default' => 'traditional', | |
| 191 | + ] | |
| 192 | + ); | |
| 193 | + | |
| 207 | 194 | $this->end_controls_section(); |
| 208 | 195 | |
| 209 | 196 | $this->start_controls_section( |
| 210 | 197 | 'section_map_style', |
| 211 | 198 | [ |
| 212 | - 'label' => esc_html__( 'Google Maps', 'elementor' ), | |
| 199 | + 'label' => esc_html__( 'Map', 'elementor' ), | |
| 213 | 200 | 'tab' => Controls_Manager::TAB_STYLE, |
| 214 | 201 | ] |
| 215 | 202 | ); |
| 216 | 203 | |
| @@ -248,13 +235,12 @@ | ||
| 248 | 235 | |
| 249 | 236 | $this->add_control( |
| 250 | 237 | 'hover_transition', |
| 251 | 238 | [ |
| 252 | - 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (s)', | |
| 239 | + 'label' => esc_html__( 'Transition Duration', 'elementor' ), | |
| 253 | 240 | 'type' => Controls_Manager::SLIDER, |
| 254 | 241 | 'range' => [ |
| 255 | 242 | 'px' => [ |
| 256 | - 'min' => 0, | |
| 257 | 243 | 'max' => 3, |
| 258 | 244 | 'step' => 0.1, |
| 259 | 245 | ], |
| 260 | 246 | ], |
| @@ -306,9 +292,9 @@ | ||
| 306 | 292 | } |
| 307 | 293 | |
| 308 | 294 | ?> |
| 309 | 295 | <div class="elementor-custom-embed"> |
| 310 | - <iframe loading="lazy" | |
| 296 | + <iframe frameborder="0" scrolling="no" marginheight="0" marginwidth="0" | |
| 311 | 297 | src="<?php echo esc_url( vsprintf( $url, $params ) ); ?>" |
| 312 | 298 | title="<?php echo esc_attr( $settings['address'] ); ?>" |
| 313 | 299 | aria-label="<?php echo esc_attr( $settings['address'] ); ?>" |
| 314 | 300 | ></iframe> |
| @@ -324,14 +310,5 @@ | ||
| 324 | 310 | * @since 2.9.0 |
| 325 | 311 | * @access protected |
| 326 | 312 | */ |
| 327 | 313 | 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 | 314 | } |