| @@ -73,12 +73,8 @@ | ||
| 73 | 73 | public function get_categories() { |
| 74 | 74 | return [ 'basic' ]; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public function has_widget_inner_wrapper(): bool { | |
| 78 | - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); | |
| 79 | - } | |
| 80 | - | |
| 81 | 77 | /** |
| 82 | 78 | * Get widget keywords. |
| 83 | 79 | * |
| 84 | 80 | * Retrieve the list of keywords the widget belongs to. |
| @@ -91,12 +87,8 @@ | ||
| 91 | 87 | public function get_keywords() { |
| 92 | 88 | return [ 'icon' ]; |
| 93 | 89 | } |
| 94 | 90 | |
| 95 | - protected function is_dynamic_content(): bool { | |
| 96 | - return false; | |
| 97 | - } | |
| 98 | - | |
| 99 | 91 | /** |
| 100 | 92 | * Register icon widget controls. |
| 101 | 93 | * |
| 102 | 94 | * Adds different input fields to allow the user to change and customize the widget settings. |
| @@ -145,11 +137,10 @@ | ||
| 145 | 137 | [ |
| 146 | 138 | 'label' => esc_html__( 'Shape', 'elementor' ), |
| 147 | 139 | 'type' => Controls_Manager::SELECT, |
| 148 | 140 | 'options' => [ |
| 141 | + 'circle' => esc_html__( 'Circle', 'elementor' ), | |
| 149 | 142 | 'square' => esc_html__( 'Square', 'elementor' ), |
| 150 | - 'rounded' => esc_html__( 'Rounded', 'elementor' ), | |
| 151 | - 'circle' => esc_html__( 'Circle', 'elementor' ), | |
| 152 | 143 | ], |
| 153 | 144 | 'default' => 'circle', |
| 154 | 145 | 'condition' => [ |
| 155 | 146 | 'view!' => 'default', |
| @@ -165,21 +156,12 @@ | ||
| 165 | 156 | 'type' => Controls_Manager::URL, |
| 166 | 157 | 'dynamic' => [ |
| 167 | 158 | 'active' => true, |
| 168 | 159 | ], |
| 160 | + 'placeholder' => esc_html__( 'https://your-link.com', 'elementor' ), | |
| 169 | 161 | ] |
| 170 | 162 | ); |
| 171 | 163 | |
| 172 | - $this->end_controls_section(); | |
| 173 | - | |
| 174 | - $this->start_controls_section( | |
| 175 | - 'section_style_icon', | |
| 176 | - [ | |
| 177 | - 'label' => esc_html__( 'Icon', 'elementor' ), | |
| 178 | - 'tab' => Controls_Manager::TAB_STYLE, | |
| 179 | - ] | |
| 180 | - ); | |
| 181 | - | |
| 182 | 164 | $this->add_responsive_control( |
| 183 | 165 | 'align', |
| 184 | 166 | [ |
| 185 | 167 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| @@ -184,10 +166,10 @@ | ||
| 184 | 166 | [ |
| 185 | 167 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| 186 | 168 | 'type' => Controls_Manager::CHOOSE, |
| 187 | 169 | 'options' => [ |
| 188 | - 'start' => [ | |
| 189 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 170 | + 'left' => [ | |
| 171 | + 'title' => esc_html__( 'Left', 'elementor' ), | |
| 190 | 172 | 'icon' => 'eicon-text-align-left', |
| 191 | 173 | ], |
| 192 | 174 | 'center' => [ |
| 193 | 175 | 'title' => esc_html__( 'Center', 'elementor' ), |
| @@ -192,18 +174,13 @@ | ||
| 192 | 174 | 'center' => [ |
| 193 | 175 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 194 | 176 | 'icon' => 'eicon-text-align-center', |
| 195 | 177 | ], |
| 196 | - 'end' => [ | |
| 197 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 178 | + 'right' => [ | |
| 179 | + 'title' => esc_html__( 'Right', 'elementor' ), | |
| 198 | 180 | 'icon' => 'eicon-text-align-right', |
| 199 | 181 | ], |
| 200 | 182 | ], |
| 201 | - 'classes' => 'elementor-control-start-end', | |
| 202 | - 'selectors_dictionary' => [ | |
| 203 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 204 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 205 | - ], | |
| 206 | 183 | 'default' => 'center', |
| 207 | 184 | 'selectors' => [ |
| 208 | 185 | '{{WRAPPER}} .elementor-icon-wrapper' => 'text-align: {{VALUE}};', |
| 209 | 186 | ], |
| @@ -209,8 +186,18 @@ | ||
| 209 | 186 | ], |
| 210 | 187 | ] |
| 211 | 188 | ); |
| 212 | 189 | |
| 190 | + $this->end_controls_section(); | |
| 191 | + | |
| 192 | + $this->start_controls_section( | |
| 193 | + 'section_style_icon', | |
| 194 | + [ | |
| 195 | + 'label' => esc_html__( 'Icon', 'elementor' ), | |
| 196 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 197 | + ] | |
| 198 | + ); | |
| 199 | + | |
| 213 | 200 | $this->start_controls_tabs( 'icon_colors' ); |
| 214 | 201 | |
| 215 | 202 | $this->start_controls_tab( |
| 216 | 203 | 'icon_colors_normal', |
| @@ -309,9 +296,9 @@ | ||
| 309 | 296 | 'size', |
| 310 | 297 | [ |
| 311 | 298 | 'label' => esc_html__( 'Size', 'elementor' ), |
| 312 | 299 | 'type' => Controls_Manager::SLIDER, |
| 313 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], | |
| 300 | + 'size_units' => [ 'px', '%', 'em', 'rem' ], | |
| 314 | 301 | 'range' => [ |
| 315 | 302 | 'px' => [ |
| 316 | 303 | 'min' => 6, |
| 317 | 304 | 'max' => 300, |
| @@ -318,9 +305,8 @@ | ||
| 318 | 305 | ], |
| 319 | 306 | ], |
| 320 | 307 | 'selectors' => [ |
| 321 | 308 | '{{WRAPPER}} .elementor-icon' => 'font-size: {{SIZE}}{{UNIT}};', |
| 322 | - '{{WRAPPER}} .elementor-icon svg' => 'height: {{SIZE}}{{UNIT}};', | |
| 323 | 309 | ], |
| 324 | 310 | 'separator' => 'before', |
| 325 | 311 | ] |
| 326 | 312 | ); |
| @@ -325,45 +311,20 @@ | ||
| 325 | 311 | ] |
| 326 | 312 | ); |
| 327 | 313 | |
| 328 | 314 | $this->add_control( |
| 329 | - 'fit_to_size', | |
| 330 | - [ | |
| 331 | - 'label' => esc_html__( 'Fit to Size', 'elementor' ), | |
| 332 | - 'type' => Controls_Manager::SWITCHER, | |
| 333 | - 'description' => 'Avoid gaps around icons when width and height aren\'t equal', | |
| 334 | - 'label_off' => esc_html__( 'Off', 'elementor' ), | |
| 335 | - 'label_on' => esc_html__( 'On', 'elementor' ), | |
| 336 | - 'condition' => [ | |
| 337 | - 'selected_icon[library]' => 'svg', | |
| 338 | - ], | |
| 339 | - 'selectors' => [ | |
| 340 | - '{{WRAPPER}} .elementor-icon-wrapper svg' => 'width: auto;', | |
| 341 | - ], | |
| 342 | - ] | |
| 343 | - ); | |
| 344 | - | |
| 345 | - $this->add_control( | |
| 346 | 315 | 'icon_padding', |
| 347 | 316 | [ |
| 348 | 317 | 'label' => esc_html__( 'Padding', 'elementor' ), |
| 349 | 318 | 'type' => Controls_Manager::SLIDER, |
| 350 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], | |
| 351 | 319 | 'selectors' => [ |
| 352 | 320 | '{{WRAPPER}} .elementor-icon' => 'padding: {{SIZE}}{{UNIT}};', |
| 353 | 321 | ], |
| 354 | 322 | 'range' => [ |
| 355 | - 'px' => [ | |
| 356 | - 'max' => 50, | |
| 357 | - ], | |
| 358 | 323 | 'em' => [ |
| 359 | 324 | 'min' => 0, |
| 360 | 325 | 'max' => 5, |
| 361 | 326 | ], |
| 362 | - 'rem' => [ | |
| 363 | - 'min' => 0, | |
| 364 | - 'max' => 5, | |
| 365 | - ], | |
| 366 | 327 | ], |
| 367 | 328 | 'condition' => [ |
| 368 | 329 | 'view!' => 'default', |
| 369 | 330 | ], |
| @@ -374,10 +335,11 @@ | ||
| 374 | 335 | 'rotate', |
| 375 | 336 | [ |
| 376 | 337 | 'label' => esc_html__( 'Rotate', 'elementor' ), |
| 377 | 338 | 'type' => Controls_Manager::SLIDER, |
| 378 | - 'size_units' => [ 'deg', 'grad', 'rad', 'turn', 'custom' ], | |
| 339 | + 'size_units' => [ 'deg' ], | |
| 379 | 340 | 'default' => [ |
| 341 | + 'size' => 0, | |
| 380 | 342 | 'unit' => 'deg', |
| 381 | 343 | ], |
| 382 | 344 | 'tablet_default' => [ |
| 383 | 345 | 'unit' => 'deg', |
| @@ -395,9 +357,8 @@ | ||
| 395 | 357 | 'border_width', |
| 396 | 358 | [ |
| 397 | 359 | 'label' => esc_html__( 'Border Width', 'elementor' ), |
| 398 | 360 | 'type' => Controls_Manager::DIMENSIONS, |
| 399 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], | |
| 400 | 361 | 'selectors' => [ |
| 401 | 362 | '{{WRAPPER}} .elementor-icon' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 402 | 363 | ], |
| 403 | 364 | 'condition' => [ |
| @@ -405,14 +366,14 @@ | ||
| 405 | 366 | ], |
| 406 | 367 | ] |
| 407 | 368 | ); |
| 408 | 369 | |
| 409 | - $this->add_responsive_control( | |
| 370 | + $this->add_control( | |
| 410 | 371 | 'border_radius', |
| 411 | 372 | [ |
| 412 | 373 | 'label' => esc_html__( 'Border Radius', 'elementor' ), |
| 413 | 374 | 'type' => Controls_Manager::DIMENSIONS, |
| 414 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], | |
| 375 | + 'size_units' => [ 'px', '%', 'em' ], | |
| 415 | 376 | 'selectors' => [ |
| 416 | 377 | '{{WRAPPER}} .elementor-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 417 | 378 | ], |
| 418 | 379 | 'condition' => [ |
| @@ -434,12 +395,8 @@ | ||
| 434 | 395 | */ |
| 435 | 396 | protected function render() { |
| 436 | 397 | $settings = $this->get_settings_for_display(); |
| 437 | 398 | |
| 438 | - if ( empty( $settings['selected_icon']['value'] ) ) { | |
| 439 | - return; | |
| 440 | - } | |
| 441 | - | |
| 442 | 399 | $this->add_render_attribute( 'wrapper', 'class', 'elementor-icon-wrapper' ); |
| 443 | 400 | |
| 444 | 401 | $this->add_render_attribute( 'icon-wrapper', 'class', 'elementor-icon' ); |
| 445 | 402 | |
| @@ -469,15 +426,15 @@ | ||
| 469 | 426 | $is_new = empty( $settings['icon'] ) && Icons_Manager::is_migration_allowed(); |
| 470 | 427 | |
| 471 | 428 | ?> |
| 472 | 429 | <div <?php $this->print_render_attribute_string( 'wrapper' ); ?>> |
| 473 | - <<?php Utils::print_validated_html_tag( $icon_tag ); ?> <?php $this->print_render_attribute_string( 'icon-wrapper' ); ?>> | |
| 430 | + <<?php Utils::print_unescaped_internal_string( $icon_tag . ' ' . $this->get_render_attribute_string( 'icon-wrapper' ) ); ?>> | |
| 474 | 431 | <?php if ( $is_new || $migrated ) : |
| 475 | 432 | Icons_Manager::render_icon( $settings['selected_icon'], [ 'aria-hidden' => 'true' ] ); |
| 476 | 433 | else : ?> |
| 477 | 434 | <i <?php $this->print_render_attribute_string( 'icon' ); ?>></i> |
| 478 | 435 | <?php endif; ?> |
| 479 | - </<?php Utils::print_validated_html_tag( $icon_tag ); ?>> | |
| 436 | + </<?php Utils::print_unescaped_internal_string( $icon_tag ); ?>> | |
| 480 | 437 | </div> |
| 481 | 438 | <?php |
| 482 | 439 | } |
| 483 | 440 | |
| @@ -490,31 +447,15 @@ | ||
| 490 | 447 | * @access protected |
| 491 | 448 | */ |
| 492 | 449 | protected function content_template() { |
| 493 | 450 | ?> |
| 494 | - <# | |
| 495 | - if ( '' === settings.selected_icon.value ) { | |
| 496 | - return; | |
| 497 | - } | |
| 498 | - | |
| 499 | - let iconTag = 'div'; | |
| 500 | - | |
| 501 | - if ( settings.link?.url ) { | |
| 502 | - view.addRenderAttribute( 'link_url', 'href', elementor.helpers.sanitizeUrl( settings.link?.url ) ); | |
| 503 | - iconTag = 'a'; | |
| 504 | - } | |
| 505 | - | |
| 506 | - const iconHTML = elementor.helpers.renderIcon( view, settings.selected_icon, { 'aria-hidden': true }, 'i' , 'object' ), | |
| 507 | - migrated = elementor.helpers.isIconMigrated( settings, 'selected_icon' ); | |
| 508 | - | |
| 509 | - view.addRenderAttribute( 'icon', 'class', 'elementor-icon' ); | |
| 510 | - | |
| 511 | - if ( '' !== settings.hover_animation ) { | |
| 512 | - view.addRenderAttribute( 'icon', 'class', 'elementor-animation-' + settings.hover_animation ); | |
| 513 | - } | |
| 451 | + <# var link = settings.link.url ? 'href="' + settings.link.url + '"' : '', | |
| 452 | + iconHTML = elementor.helpers.renderIcon( view, settings.selected_icon, { 'aria-hidden': true }, 'i' , 'object' ), | |
| 453 | + migrated = elementor.helpers.isIconMigrated( settings, 'selected_icon' ), | |
| 454 | + iconTag = link ? 'a' : 'div'; | |
| 514 | 455 | #> |
| 515 | 456 | <div class="elementor-icon-wrapper"> |
| 516 | - <{{{ iconTag }}} {{{ view.getRenderAttributeString( 'icon' ) }}} {{{ view.getRenderAttributeString( 'link_url' ) }}}> | |
| 457 | + <{{{ iconTag }}} class="elementor-icon elementor-animation-{{ settings.hover_animation }}" {{{ link }}}> | |
| 517 | 458 | <# if ( iconHTML && iconHTML.rendered && ( ! settings.icon || migrated ) ) { #> |
| 518 | 459 | {{{ iconHTML.value }}} |
| 519 | 460 | <# } else { #> |
| 520 | 461 | <i class="{{ settings.icon }}" aria-hidden="true"></i> |
| @@ -521,10 +462,6 @@ | ||
| 521 | 462 | <# } #> |
| 522 | 463 | </{{{ iconTag }}}> |
| 523 | 464 | </div> |
| 524 | 465 | <?php |
| 525 | - } | |
| 526 | - | |
| 527 | - public function render_markdown(): string { | |
| 528 | - return ''; | |
| 529 | 466 | } |
| 530 | 467 | } |