PluginProbe
Elementor Website Builder – more than just a page builder / 3.7.3
Elementor Website Builder – more than just a page builder v3.7.3
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | includes/widgets/icon.php +27 -91 4.2.33.7.3 View file →
@@ -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,8 @@
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' ],
314 300 'range' => [
315 301 'px' => [
316 302 'min' => 6,
317 303 'max' => 300,
@@ -318,9 +304,8 @@
318 304 ],
319 305 ],
320 306 'selectors' => [
321 307 '{{WRAPPER}} .elementor-icon' => 'font-size: {{SIZE}}{{UNIT}};',
322 - '{{WRAPPER}} .elementor-icon svg' => 'height: {{SIZE}}{{UNIT}};',
323 308 ],
324 309 'separator' => 'before',
325 310 ]
326 311 );
@@ -325,45 +310,20 @@
325 310 ]
326 311 );
327 312
328 313 $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 314 'icon_padding',
347 315 [
348 316 'label' => esc_html__( 'Padding', 'elementor' ),
349 317 'type' => Controls_Manager::SLIDER,
350 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
351 318 'selectors' => [
352 319 '{{WRAPPER}} .elementor-icon' => 'padding: {{SIZE}}{{UNIT}};',
353 320 ],
354 321 'range' => [
355 - 'px' => [
356 - 'max' => 50,
357 - ],
358 322 'em' => [
359 323 'min' => 0,
360 324 'max' => 5,
361 325 ],
362 - 'rem' => [
363 - 'min' => 0,
364 - 'max' => 5,
365 - ],
366 326 ],
367 327 'condition' => [
368 328 'view!' => 'default',
369 329 ],
@@ -374,10 +334,11 @@
374 334 'rotate',
375 335 [
376 336 'label' => esc_html__( 'Rotate', 'elementor' ),
377 337 'type' => Controls_Manager::SLIDER,
378 - 'size_units' => [ 'deg', 'grad', 'rad', 'turn', 'custom' ],
338 + 'size_units' => [ 'deg' ],
379 339 'default' => [
340 + 'size' => 0,
380 341 'unit' => 'deg',
381 342 ],
382 343 'tablet_default' => [
383 344 'unit' => 'deg',
@@ -395,9 +356,8 @@
395 356 'border_width',
396 357 [
397 358 'label' => esc_html__( 'Border Width', 'elementor' ),
398 359 'type' => Controls_Manager::DIMENSIONS,
399 - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
400 360 'selectors' => [
401 361 '{{WRAPPER}} .elementor-icon' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
402 362 ],
403 363 'condition' => [
@@ -405,14 +365,14 @@
405 365 ],
406 366 ]
407 367 );
408 368
409 - $this->add_responsive_control(
369 + $this->add_control(
410 370 'border_radius',
411 371 [
412 372 'label' => esc_html__( 'Border Radius', 'elementor' ),
413 373 'type' => Controls_Manager::DIMENSIONS,
414 - 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ],
374 + 'size_units' => [ 'px', '%', 'em' ],
415 375 'selectors' => [
416 376 '{{WRAPPER}} .elementor-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
417 377 ],
418 378 'condition' => [
@@ -434,12 +394,8 @@
434 394 */
435 395 protected function render() {
436 396 $settings = $this->get_settings_for_display();
437 397
438 - if ( empty( $settings['selected_icon']['value'] ) ) {
439 - return;
440 - }
441 -
442 398 $this->add_render_attribute( 'wrapper', 'class', 'elementor-icon-wrapper' );
443 399
444 400 $this->add_render_attribute( 'icon-wrapper', 'class', 'elementor-icon' );
445 401
@@ -469,15 +425,15 @@
469 425 $is_new = empty( $settings['icon'] ) && Icons_Manager::is_migration_allowed();
470 426
471 427 ?>
472 428 <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' ); ?>>
429 + <<?php Utils::print_unescaped_internal_string( $icon_tag . ' ' . $this->get_render_attribute_string( 'icon-wrapper' ) ); ?>>
474 430 <?php if ( $is_new || $migrated ) :
475 431 Icons_Manager::render_icon( $settings['selected_icon'], [ 'aria-hidden' => 'true' ] );
476 432 else : ?>
477 433 <i <?php $this->print_render_attribute_string( 'icon' ); ?>></i>
478 434 <?php endif; ?>
479 - </<?php Utils::print_validated_html_tag( $icon_tag ); ?>>
435 + </<?php Utils::print_unescaped_internal_string( $icon_tag ); ?>>
480 436 </div>
481 437 <?php
482 438 }
483 439
@@ -490,31 +446,15 @@
490 446 * @access protected
491 447 */
492 448 protected function content_template() {
493 449 ?>
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 - }
450 + <# var link = settings.link.url ? 'href="' + settings.link.url + '"' : '',
451 + iconHTML = elementor.helpers.renderIcon( view, settings.selected_icon, { 'aria-hidden': true }, 'i' , 'object' ),
452 + migrated = elementor.helpers.isIconMigrated( settings, 'selected_icon' ),
453 + iconTag = link ? 'a' : 'div';
514 454 #>
515 455 <div class="elementor-icon-wrapper">
516 - <{{{ iconTag }}} {{{ view.getRenderAttributeString( 'icon' ) }}} {{{ view.getRenderAttributeString( 'link_url' ) }}}>
456 + <{{{ iconTag }}} class="elementor-icon elementor-animation-{{ settings.hover_animation }}" {{{ link }}}>
517 457 <# if ( iconHTML && iconHTML.rendered && ( ! settings.icon || migrated ) ) { #>
518 458 {{{ iconHTML.value }}}
519 459 <# } else { #>
520 460 <i class="{{ settings.icon }}" aria-hidden="true"></i>
@@ -521,10 +461,6 @@
521 461 <# } #>
522 462 </{{{ iconTag }}}>
523 463 </div>
524 464 <?php
525 - }
526 -
527 - public function render_markdown(): string {
528 - return '';
529 465 }
530 466 }