| @@ -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', |
| @@ -168,18 +159,8 @@ | ||
| 168 | 159 | ], |
| 169 | 160 | ] |
| 170 | 161 | ); |
| 171 | 162 | |
| 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 | 163 | $this->add_responsive_control( |
| 183 | 164 | 'align', |
| 184 | 165 | [ |
| 185 | 166 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| @@ -184,10 +165,10 @@ | ||
| 184 | 165 | [ |
| 185 | 166 | 'label' => esc_html__( 'Alignment', 'elementor' ), |
| 186 | 167 | 'type' => Controls_Manager::CHOOSE, |
| 187 | 168 | 'options' => [ |
| 188 | - 'start' => [ | |
| 189 | - 'title' => esc_html__( 'Start', 'elementor' ), | |
| 169 | + 'left' => [ | |
| 170 | + 'title' => esc_html__( 'Left', 'elementor' ), | |
| 190 | 171 | 'icon' => 'eicon-text-align-left', |
| 191 | 172 | ], |
| 192 | 173 | 'center' => [ |
| 193 | 174 | 'title' => esc_html__( 'Center', 'elementor' ), |
| @@ -192,18 +173,13 @@ | ||
| 192 | 173 | 'center' => [ |
| 193 | 174 | 'title' => esc_html__( 'Center', 'elementor' ), |
| 194 | 175 | 'icon' => 'eicon-text-align-center', |
| 195 | 176 | ], |
| 196 | - 'end' => [ | |
| 197 | - 'title' => esc_html__( 'End', 'elementor' ), | |
| 177 | + 'right' => [ | |
| 178 | + 'title' => esc_html__( 'Right', 'elementor' ), | |
| 198 | 179 | 'icon' => 'eicon-text-align-right', |
| 199 | 180 | ], |
| 200 | 181 | ], |
| 201 | - 'classes' => 'elementor-control-start-end', | |
| 202 | - 'selectors_dictionary' => [ | |
| 203 | - 'left' => is_rtl() ? 'end' : 'start', | |
| 204 | - 'right' => is_rtl() ? 'start' : 'end', | |
| 205 | - ], | |
| 206 | 182 | 'default' => 'center', |
| 207 | 183 | 'selectors' => [ |
| 208 | 184 | '{{WRAPPER}} .elementor-icon-wrapper' => 'text-align: {{VALUE}};', |
| 209 | 185 | ], |
| @@ -209,8 +185,18 @@ | ||
| 209 | 185 | ], |
| 210 | 186 | ] |
| 211 | 187 | ); |
| 212 | 188 | |
| 189 | + $this->end_controls_section(); | |
| 190 | + | |
| 191 | + $this->start_controls_section( | |
| 192 | + 'section_style_icon', | |
| 193 | + [ | |
| 194 | + 'label' => esc_html__( 'Icon', 'elementor' ), | |
| 195 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 196 | + ] | |
| 197 | + ); | |
| 198 | + | |
| 213 | 199 | $this->start_controls_tabs( 'icon_colors' ); |
| 214 | 200 | |
| 215 | 201 | $this->start_controls_tab( |
| 216 | 202 | 'icon_colors_normal', |
| @@ -336,9 +322,9 @@ | ||
| 336 | 322 | 'condition' => [ |
| 337 | 323 | 'selected_icon[library]' => 'svg', |
| 338 | 324 | ], |
| 339 | 325 | 'selectors' => [ |
| 340 | - '{{WRAPPER}} .elementor-icon-wrapper svg' => 'width: auto;', | |
| 326 | + '{{WRAPPER}} .elementor-icon-wrapper svg' => 'width: 100%;', | |
| 341 | 327 | ], |
| 342 | 328 | ] |
| 343 | 329 | ); |
| 344 | 330 | |
| @@ -346,24 +332,16 @@ | ||
| 346 | 332 | 'icon_padding', |
| 347 | 333 | [ |
| 348 | 334 | 'label' => esc_html__( 'Padding', 'elementor' ), |
| 349 | 335 | 'type' => Controls_Manager::SLIDER, |
| 350 | - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], | |
| 351 | 336 | 'selectors' => [ |
| 352 | 337 | '{{WRAPPER}} .elementor-icon' => 'padding: {{SIZE}}{{UNIT}};', |
| 353 | 338 | ], |
| 354 | 339 | 'range' => [ |
| 355 | - 'px' => [ | |
| 356 | - 'max' => 50, | |
| 357 | - ], | |
| 358 | 340 | 'em' => [ |
| 359 | 341 | 'min' => 0, |
| 360 | 342 | 'max' => 5, |
| 361 | 343 | ], |
| 362 | - 'rem' => [ | |
| 363 | - 'min' => 0, | |
| 364 | - 'max' => 5, | |
| 365 | - ], | |
| 366 | 344 | ], |
| 367 | 345 | 'condition' => [ |
| 368 | 346 | 'view!' => 'default', |
| 369 | 347 | ], |
| @@ -434,12 +412,8 @@ | ||
| 434 | 412 | */ |
| 435 | 413 | protected function render() { |
| 436 | 414 | $settings = $this->get_settings_for_display(); |
| 437 | 415 | |
| 438 | - if ( empty( $settings['selected_icon']['value'] ) ) { | |
| 439 | - return; | |
| 440 | - } | |
| 441 | - | |
| 442 | 416 | $this->add_render_attribute( 'wrapper', 'class', 'elementor-icon-wrapper' ); |
| 443 | 417 | |
| 444 | 418 | $this->add_render_attribute( 'icon-wrapper', 'class', 'elementor-icon' ); |
| 445 | 419 | |
| @@ -469,15 +443,15 @@ | ||
| 469 | 443 | $is_new = empty( $settings['icon'] ) && Icons_Manager::is_migration_allowed(); |
| 470 | 444 | |
| 471 | 445 | ?> |
| 472 | 446 | <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' ); ?>> | |
| 447 | + <<?php Utils::print_unescaped_internal_string( $icon_tag . ' ' . $this->get_render_attribute_string( 'icon-wrapper' ) ); ?>> | |
| 474 | 448 | <?php if ( $is_new || $migrated ) : |
| 475 | 449 | Icons_Manager::render_icon( $settings['selected_icon'], [ 'aria-hidden' => 'true' ] ); |
| 476 | 450 | else : ?> |
| 477 | 451 | <i <?php $this->print_render_attribute_string( 'icon' ); ?>></i> |
| 478 | 452 | <?php endif; ?> |
| 479 | - </<?php Utils::print_validated_html_tag( $icon_tag ); ?>> | |
| 453 | + </<?php Utils::print_unescaped_internal_string( $icon_tag ); ?>> | |
| 480 | 454 | </div> |
| 481 | 455 | <?php |
| 482 | 456 | } |
| 483 | 457 | |
| @@ -490,31 +464,15 @@ | ||
| 490 | 464 | * @access protected |
| 491 | 465 | */ |
| 492 | 466 | protected function content_template() { |
| 493 | 467 | ?> |
| 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 | - } | |
| 468 | + <# const link = settings.link.url ? 'href="' + settings.link.url + '"' : '', | |
| 469 | + iconHTML = elementor.helpers.renderIcon( view, settings.selected_icon, { 'aria-hidden': true }, 'i' , 'object' ), | |
| 470 | + migrated = elementor.helpers.isIconMigrated( settings, 'selected_icon' ), | |
| 471 | + iconTag = link ? 'a' : 'div'; | |
| 514 | 472 | #> |
| 515 | 473 | <div class="elementor-icon-wrapper"> |
| 516 | - <{{{ iconTag }}} {{{ view.getRenderAttributeString( 'icon' ) }}} {{{ view.getRenderAttributeString( 'link_url' ) }}}> | |
| 474 | + <{{{ iconTag }}} class="elementor-icon elementor-animation-{{ settings.hover_animation }}" {{{ link }}}> | |
| 517 | 475 | <# if ( iconHTML && iconHTML.rendered && ( ! settings.icon || migrated ) ) { #> |
| 518 | 476 | {{{ iconHTML.value }}} |
| 519 | 477 | <# } else { #> |
| 520 | 478 | <i class="{{ settings.icon }}" aria-hidden="true"></i> |
| @@ -521,10 +479,6 @@ | ||
| 521 | 479 | <# } #> |
| 522 | 480 | </{{{ iconTag }}}> |
| 523 | 481 | </div> |
| 524 | 482 | <?php |
| 525 | - } | |
| 526 | - | |
| 527 | - public function render_markdown(): string { | |
| 528 | - return ''; | |
| 529 | 483 | } |
| 530 | 484 | } |