PluginProbe
Elementor Website Builder – more than just a page builder / 3.17.2
Elementor Website Builder – more than just a page builder v3.17.2
4.3.1 4.3.0 4.3.0-beta3 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 All 454 releases
← All changes | includes/widgets/social-icons.php +25 -120 4.3.0-beta2 → 3.17.2 View file →
@@ -69,31 +69,9 @@
69 69 public function get_keywords() {
70 70 return [ 'social', 'icon', 'link' ];
71 71 }
72 72
73 - protected function is_dynamic_content(): bool {
74 - return false;
75 - }
76 -
77 73 /**
78 - * Get style dependencies.
79 - *
80 - * Retrieve the list of style dependencies the widget requires.
81 - *
82 - * @since 3.24.0
83 - * @access public
84 - *
85 - * @return array Widget style dependencies.
86 - */
87 - public function get_style_depends(): array {
88 - return [ 'widget-social-icons', 'e-apple-webkit' ];
89 - }
90 -
91 - public function has_widget_inner_wrapper(): bool {
92 - return ! Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
93 - }
94 -
95 - /**
96 74 * Register social icons widget controls.
97 75 *
98 76 * Adds different input fields to allow the user to change and customize the widget settings.
99 77 *
@@ -160,9 +138,8 @@
160 138 'stack-overflow',
161 139 'steam',
162 140 'telegram',
163 141 'thumb-tack',
164 - 'threads',
165 142 'tripadvisor',
166 143 'tumblr',
167 144 'twitch',
168 145 'twitter',
@@ -173,9 +150,8 @@
173 150 'weixin',
174 151 'whatsapp',
175 152 'wordpress',
176 153 'xing',
177 - 'x-twitter',
178 154 'yelp',
179 155 'youtube',
180 156 '500px',
181 157 ],
@@ -258,9 +234,9 @@
258 234 ],
259 235 ],
260 236 [
261 237 'social_icon' => [
262 - 'value' => 'fab fa-x-twitter',
238 + 'value' => 'fab fa-twitter',
263 239 'library' => 'fa-brands',
264 240 ],
265 241 ],
266 242 [
@@ -280,10 +256,10 @@
280 256 'label' => esc_html__( 'Shape', 'elementor' ),
281 257 'type' => Controls_Manager::SELECT,
282 258 'default' => 'rounded',
283 259 'options' => [
260 + 'rounded' => esc_html__( 'Rounded', 'elementor' ),
284 261 'square' => esc_html__( 'Square', 'elementor' ),
285 - 'rounded' => esc_html__( 'Rounded', 'elementor' ),
286 262 'circle' => esc_html__( 'Circle', 'elementor' ),
287 263 ],
288 264 'prefix_class' => 'elementor-shape-',
289 265 ]
@@ -310,11 +286,10 @@
310 286 ],
311 287 ]
312 288 );
313 289
314 - $align_selector = Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ) && ! $this->has_widget_inner_wrapper()
315 - ? '{{WRAPPER}}'
316 - : '{{WRAPPER}} .elementor-widget-container';
290 + $start = is_rtl() ? 'end' : 'start';
291 + $end = is_rtl() ? 'start' : 'end';
317 292
318 293 $this->add_responsive_control(
319 294 'align',
320 295 [
@@ -336,13 +311,22 @@
336 311 ],
337 312 'prefix_class' => 'e-grid-align%s-',
338 313 'default' => 'center',
339 314 'selectors' => [
340 - $align_selector => 'text-align: {{VALUE}}',
315 + '{{WRAPPER}} .elementor-widget-container' => 'text-align: {{VALUE}}',
341 316 ],
342 317 ]
343 318 );
344 319
320 + $this->add_control(
321 + 'view',
322 + [
323 + 'label' => esc_html__( 'View', 'elementor' ),
324 + 'type' => Controls_Manager::HIDDEN,
325 + 'default' => 'traditional',
326 + ]
327 + );
328 +
345 329 $this->end_controls_section();
346 330
347 331 $this->start_controls_section(
348 332 'section_social_style',
@@ -417,10 +401,8 @@
417 401 'icon_padding',
418 402 [
419 403 'label' => esc_html__( 'Padding', 'elementor' ),
420 404 'type' => Controls_Manager::SLIDER,
421 - // The `%' unit is not supported.
422 - 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
423 405 'selectors' => [
424 406 '{{WRAPPER}} .elementor-social-icon' => '--icon-padding: {{SIZE}}{{UNIT}}',
425 407 ],
426 408 'default' => [
@@ -432,19 +414,12 @@
432 414 'mobile_default' => [
433 415 'unit' => 'em',
434 416 ],
435 417 'range' => [
436 - 'px' => [
437 - 'max' => 50,
438 - ],
439 418 'em' => [
440 419 'min' => 0,
441 420 'max' => 5,
442 421 ],
443 - 'rem' => [
444 - 'min' => 0,
445 - 'max' => 5,
446 - ],
447 422 ],
448 423 ]
449 424 );
450 425
@@ -452,21 +427,13 @@
452 427 'icon_spacing',
453 428 [
454 429 'label' => esc_html__( 'Spacing', 'elementor' ),
455 430 'type' => Controls_Manager::SLIDER,
456 - 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
457 431 'range' => [
458 432 'px' => [
433 + 'min' => 0,
459 434 'max' => 100,
460 435 ],
461 - 'em' => [
462 - 'min' => 0,
463 - 'max' => 10,
464 - ],
465 - 'rem' => [
466 - 'min' => 0,
467 - 'max' => 10,
468 - ],
469 436 ],
470 437 'default' => [
471 438 'size' => 5,
472 439 ],
@@ -480,9 +447,8 @@
480 447 'row_gap',
481 448 [
482 449 'label' => esc_html__( 'Rows Gap', 'elementor' ),
483 450 'type' => Controls_Manager::SLIDER,
484 - 'size_units' => [ 'px', 'em', 'rem', 'custom' ],
485 451 'default' => [
486 452 'size' => 0,
487 453 ],
488 454 'selectors' => [
@@ -576,8 +542,9 @@
576 542 ]
577 543 );
578 544
579 545 $this->end_controls_section();
546 +
580 547 }
581 548
582 549 /**
583 550 * Render social icons widget output on the frontend.
@@ -588,20 +555,11 @@
588 555 * @access protected
589 556 */
590 557 protected function render() {
591 558 $settings = $this->get_settings_for_display();
592 -
593 - $this->add_render_attribute( 'wrapper', 'class', [ 'elementor-social-icons-wrapper', 'elementor-grid' ] );
594 - $this->add_render_attribute( 'item_wrapper', 'class', 'elementor-grid-item' );
595 -
596 - if ( count( $settings['social_icon_list'] ) > 1 ) {
597 - $this->add_render_attribute( 'wrapper', 'role', 'list' );
598 - $this->add_render_attribute( 'item_wrapper', 'role', 'listitem' );
599 - }
600 -
601 559 $fallback_defaults = [
602 560 'fa fa-facebook',
603 - 'fa fa-x-twitter',
561 + 'fa fa-twitter',
604 562 'fa fa-google-plus',
605 563 ];
606 564
607 565 $class_animation = '';
@@ -612,9 +570,9 @@
612 570
613 571 $migration_allowed = Icons_Manager::is_migration_allowed();
614 572
615 573 ?>
616 - <div <?php $this->print_render_attribute_string( 'wrapper' ); ?>>
574 + <div class="elementor-social-icons-wrapper elementor-grid">
617 575 <?php
618 576 foreach ( $settings['social_icon_list'] as $index => $item ) {
619 577 $migrated = isset( $item['__fa4_migrated']['social_icon'] );
620 578 $is_new = empty( $item['social'] ) && $migration_allowed;
@@ -652,16 +610,16 @@
652 610
653 611 $this->add_link_attributes( $link_key, $item['link'] );
654 612
655 613 ?>
656 - <span <?php $this->print_render_attribute_string( 'item_wrapper' ); ?>>
614 + <span class="elementor-grid-item">
657 615 <a <?php $this->print_render_attribute_string( $link_key ); ?>>
658 616 <span class="elementor-screen-only"><?php echo esc_html( ucwords( $social ) ); ?></span>
659 617 <?php
660 618 if ( $is_new || $migrated ) {
661 - Icons_Manager::render_icon( $item['social_icon'], [ 'aria-hidden' => 'true' ] );
619 + Icons_Manager::render_icon( $item['social_icon'] );
662 620 } else { ?>
663 - <i class="<?php echo esc_attr( $item['social'] ); ?>" aria-hidden="true"></i>
621 + <i class="<?php echo esc_attr( $item['social'] ); ?>"></i>
664 622 <?php } ?>
665 623 </a>
666 624 </span>
667 625 <?php } ?>
@@ -678,27 +636,17 @@
678 636 * @access protected
679 637 */
680 638 protected function content_template() {
681 639 ?>
682 - <#
683 - view.addRenderAttribute( 'wrapper', 'class', [ 'elementor-social-icons-wrapper', 'elementor-grid' ] );
684 - view.addRenderAttribute( 'item_wrapper', 'class', 'elementor-grid-item' );
685 -
686 - if ( settings.social_icon_list.length > 1 ) {
687 - view.addRenderAttribute( 'wrapper', 'role', 'list' );
688 - view.addRenderAttribute( 'item_wrapper', 'role', 'listitem' );
689 - }
690 -
691 - var iconsHTML = {};
692 - #>
693 - <div {{{ view.getRenderAttributeString( 'wrapper' ) }}}>
640 + <# var iconsHTML = {}; #>
641 + <div class="elementor-social-icons-wrapper elementor-grid">
694 642 <# _.each( settings.social_icon_list, function( item, index ) {
695 643 var link = item.link ? item.link.url : '',
696 644 migrated = elementor.helpers.isIconMigrated( item, 'social_icon' );
697 645 social = elementor.helpers.getSocialNetworkNameFromIcon( item.social_icon, item.social, false, migrated );
698 646 #>
699 - <span {{{ view.getRenderAttributeString( 'item_wrapper' ) }}}>
700 - <a class="elementor-icon elementor-social-icon elementor-social-icon-{{ social }} elementor-animation-{{ settings.hover_animation }} elementor-repeater-item-{{item._id}}" href="{{ elementor.helpers.sanitizeUrl( link ) }}">
647 + <span class="elementor-grid-item">
648 + <a class="elementor-icon elementor-social-icon elementor-social-icon-{{ social }} elementor-animation-{{ settings.hover_animation }} elementor-repeater-item-{{item._id}}" href="{{ link }}">
701 649 <span class="elementor-screen-only">{{{ social }}}</span>
702 650 <#
703 651 iconsHTML[ index ] = elementor.helpers.renderIcon( view, item.social_icon, {}, 'i', 'object' );
704 652 if ( ( ! item.social || migrated ) && iconsHTML[ index ] && iconsHTML[ index ].rendered ) { #>
@@ -711,49 +659,6 @@
711 659 </span>
712 660 <# } ); #>
713 661 </div>
714 662 <?php
715 - }
716 -
717 - public function render_markdown(): string {
718 - $settings = $this->get_settings_for_display();
719 - if ( empty( $settings['social_icon_list'] ) ) {
720 - return '';
721 - }
722 -
723 - $migration_allowed = Icons_Manager::is_migration_allowed();
724 - $links = [];
725 -
726 - foreach ( $settings['social_icon_list'] as $item ) {
727 - $url = $item['link']['url'] ?? '';
728 - if ( empty( $url ) ) {
729 - continue;
730 - }
731 -
732 - $migrated = isset( $item['__fa4_migrated']['social_icon'] );
733 - $is_new = empty( $item['social'] ) && $migration_allowed;
734 - $social = '';
735 -
736 - if ( ! empty( $item['social'] ) ) {
737 - $social = str_replace( 'fa fa-', '', $item['social'] );
738 - }
739 -
740 - if ( ( $is_new || $migrated ) && 'svg' !== ( $item['social_icon']['library'] ?? '' ) ) {
741 - $parts = explode( ' ', $item['social_icon']['value'] ?? '', 2 );
742 - $social = ! empty( $parts[1] ) ? str_replace( 'fa-', '', $parts[1] ) : '';
743 - }
744 -
745 - if ( 'svg' === ( $item['social_icon']['library'] ?? '' ) ) {
746 - $social = get_post_meta( $item['social_icon']['value']['id'] ?? 0, '_wp_attachment_image_alt', true );
747 - }
748 -
749 - $label = ucwords( str_replace( '-', ' ', $social ) );
750 - if ( empty( $label ) ) {
751 - $label = 'Link';
752 - }
753 -
754 - $links[] = '- [' . $label . '](' . esc_url( $url ) . ')';
755 - }
756 -
757 - return implode( "\n", $links );
758 663 }
759 664 }