PluginProbe
Elementor Website Builder – more than just a page builder / 3.9.2
Elementor Website Builder – more than just a page builder v3.9.2
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/base/element-base.php +38 -153 4.0.73.9.2 View file →
@@ -119,12 +119,8 @@
119 119 public function get_script_depends() {
120 120 return $this->depended_scripts;
121 121 }
122 122
123 - public function get_global_scripts() {
124 - return [ 'elementor-frontend' ];
125 - }
126 -
127 123 /**
128 124 * Enqueue scripts.
129 125 *
130 126 * Registers all the scripts defined as element dependencies and enqueues
@@ -134,9 +130,9 @@
134 130 * @access public
135 131 */
136 132 final public function enqueue_scripts() {
137 133 $deprecated_scripts = [
138 - // Insert here when you have a deprecated script.
134 + //Insert here when you have a deprecated script
139 135 ];
140 136
141 137 foreach ( $this->get_script_depends() as $script ) {
142 138 if ( isset( $deprecated_scripts[ $script ] ) ) {
@@ -144,16 +140,10 @@
144 140 }
145 141
146 142 wp_enqueue_script( $script );
147 143 }
148 -
149 - foreach ( $this->get_global_scripts() as $script ) {
150 - wp_enqueue_script( $script );
151 - }
152 144 }
153 145
154 - public function register_frontend_handlers() {}
155 -
156 146 /**
157 147 * Get style dependencies.
158 148 *
159 149 * Retrieve the list of style dependencies the element requires.
@@ -295,22 +285,8 @@
295 285 return true;
296 286 }
297 287
298 288 /**
299 - * Whether the element returns dynamic content.
300 - *
301 - * Set to determine whether to cache the element output or not.
302 - *
303 - * @since 3.22.0
304 - * @access protected
305 - *
306 - * @return bool Whether to cache the element output.
307 - */
308 - protected function is_dynamic_content(): bool {
309 - return true;
310 - }
311 -
312 - /**
313 289 * Get child elements.
314 290 *
315 291 * Retrieve all the child elements of this element.
316 292 *
@@ -344,23 +320,8 @@
344 320 return self::get_items( $this->default_args, $item );
345 321 }
346 322
347 323 /**
348 - * Get panel presets.
349 - *
350 - * Used for displaying the widget in the panel multiple times, but with different defaults values,
351 - * icon, title etc.
352 - *
353 - * @since 3.16.0
354 - * @access public
355 - *
356 - * @return array
357 - */
358 - public function get_panel_presets() {
359 - return [];
360 - }
361 -
362 - /**
363 324 * Add new child element.
364 325 *
365 326 * Register new child element to allow hierarchy.
366 327 *
@@ -406,14 +367,15 @@
406 367 * @since 2.8.0
407 368 * @access public
408 369 *
409 370 * @param array|string $element The HTML element.
410 - * @param array $url_control Array of link settings.
411 - * @param bool $overwrite Optional. Whether to overwrite existing
412 - * attribute. Default is false, not to overwrite.
371 + * @param array $url_control Array of link settings.
372 + * @param bool $overwrite Optional. Whether to overwrite existing
373 + * attribute. Default is false, not to overwrite.
413 374 *
414 375 * @return Element_Base Current instance of the element.
415 376 */
377 +
416 378 public function add_link_attributes( $element, array $url_control, $overwrite = false ) {
417 379 $attributes = [];
418 380
419 381 if ( ! empty( $url_control['url'] ) ) {
@@ -430,9 +392,9 @@
430 392 $attributes['rel'] = 'nofollow';
431 393 }
432 394
433 395 if ( ! empty( $url_control['custom_attributes'] ) ) {
434 - // Custom URL attributes should come as a string of comma-delimited key|value pairs.
396 + // Custom URL attributes should come as a string of comma-delimited key|value pairs
435 397 $attributes = array_merge( $attributes, Utils::parse_custom_attributes( $url_control['custom_attributes'] ) );
436 398 }
437 399
438 400 if ( $attributes ) {
@@ -452,15 +414,8 @@
452 414 */
453 415 public function print_element() {
454 416 $element_type = $this->get_type();
455 417
456 - if ( $this->should_render_shortcode() ) {
457 - $unique_id = apply_filters( 'elementor/element_cache/unique_id', '' );
458 -
459 - echo '[elementor-element k="' . esc_attr( $unique_id ) . '" data="' . esc_attr( base64_encode( wp_json_encode( $this->get_raw_data() ) ) ) . '"]';
460 - return;
461 - }
462 -
463 418 /**
464 419 * Before frontend element render.
465 420 *
466 421 * Fires before Elementor element is rendered in the frontend.
@@ -523,10 +478,8 @@
523 478 // PHPCS - The content has already been escaped by the `render` method.
524 479 echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
525 480 $this->after_render();
526 481
527 - // TODO: Remove this in the future
528 - // Since version 3.24.0 page scripts/styles are handled by `page_assets`.
529 482 $this->enqueue_scripts();
530 483 $this->enqueue_styles();
531 484 }
532 485
@@ -554,54 +507,8 @@
554 507 */
555 508 do_action( 'elementor/frontend/after_render', $this );
556 509 }
557 510
558 - protected function should_render_shortcode() {
559 - $should_render_shortcode = apply_filters( 'elementor/element/should_render_shortcode', false );
560 -
561 - if ( ! $should_render_shortcode ) {
562 - return false;
563 - }
564 -
565 - $raw_data = $this->get_raw_data();
566 -
567 - if ( ! empty( $raw_data['settings']['_element_cache'] ) ) {
568 - return 'yes' === $raw_data['settings']['_element_cache'];
569 - }
570 -
571 - if ( $this->is_dynamic_content() ) {
572 - return true;
573 - }
574 -
575 - $is_dynamic_content = apply_filters( 'elementor/element/is_dynamic_content', false, $raw_data, $this );
576 -
577 - $has_dynamic_tag = $this->has_element_dynamic_tag( $raw_data['settings'] );
578 -
579 - if ( $is_dynamic_content || $has_dynamic_tag ) {
580 - return true;
581 - }
582 -
583 - return false;
584 - }
585 -
586 - private function has_element_dynamic_tag( $element_settings ): bool {
587 - if ( is_array( $element_settings ) ) {
588 - if ( ! empty( $element_settings['__dynamic__'] ) ) {
589 - return true;
590 - }
591 -
592 - foreach ( $element_settings as $value ) {
593 - $has_dynamic = $this->has_element_dynamic_tag( $value );
594 -
595 - if ( $has_dynamic ) {
596 - return true;
597 - }
598 - }
599 - }
600 -
601 - return false;
602 - }
603 -
604 511 /**
605 512 * Get the element raw data.
606 513 *
607 514 * Retrieve the raw element data, including the id, type, settings, child
@@ -628,9 +535,9 @@
628 535 foreach ( $this->get_children() as $child ) {
629 536 $elements[] = $child->get_raw_data( $with_html_content );
630 537 }
631 538
632 - $raw_data = [
539 + return [
633 540 'id' => $this->get_id(),
634 541 'elType' => $data['elType'],
635 542 'settings' => $data['settings'],
636 543 'elements' => $elements,
@@ -635,14 +542,8 @@
635 542 'settings' => $data['settings'],
636 543 'elements' => $elements,
637 544 'isInner' => $data['isInner'],
638 545 ];
639 -
640 - if ( ! empty( $data['isLocked'] ) ) {
641 - $raw_data['isLocked'] = $data['isLocked'];
642 - }
643 -
644 - return $raw_data;
645 546 }
646 547
647 548 public function get_data_for_save() {
648 549 $data = $this->get_raw_data();
@@ -704,9 +605,9 @@
704 605 * @param array|null $controls The available controls.
705 606 *
706 607 * @return array Element data.
707 608 */
708 - public static function on_import_update_dynamic_content( array $config, array $data, $controls = null ): array {
609 + public static function on_import_update_dynamic_content( array $config, array $data, $controls = null ) : array {
709 610 $tags_manager = Plugin::$instance->dynamic_tags;
710 611
711 612 if ( empty( $config['settings'][ $tags_manager::DYNAMIC_SETTING_KEY ] ) ) {
712 613 return $config;
@@ -739,12 +640,12 @@
739 640 * Used to add attributes to the current element wrapper HTML tag.
740 641 *
741 642 * @since 1.3.0
742 643 * @access protected
743 - * @deprecated 3.1.0 Use `add_render_attribute()` method instead.
644 + * @deprecated 3.1.0
744 645 */
745 646 protected function _add_render_attributes() {
746 - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0', 'add_render_attributes()' );
647 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0', __CLASS__ . '::add_render_attributes()' );
747 648
748 649 return $this->add_render_attributes();
749 650 }
750 651
@@ -769,9 +670,8 @@
769 670 'elementor-element-' . $id,
770 671 ],
771 672 'data-id' => $id,
772 673 'data-element_type' => $this->get_type(),
773 - 'data-e-type' => $this->get_type(),
774 674 ] );
775 675
776 676 $class_settings = [];
777 677
@@ -776,15 +676,9 @@
776 676 $class_settings = [];
777 677
778 678 foreach ( $settings as $setting_key => $setting ) {
779 679 if ( isset( $controls[ $setting_key ]['prefix_class'] ) ) {
780 - if ( isset( $controls[ $setting_key ]['classes_dictionary'][ $setting ] ) ) {
781 - $value = $controls[ $setting_key ]['classes_dictionary'][ $setting ];
782 - } else {
783 - $value = $setting;
784 - }
785 -
786 - $class_settings[ $setting_key ] = $value;
680 + $class_settings[ $setting_key ] = $setting;
787 681 }
788 682 }
789 683
790 684 foreach ( $class_settings as $setting_key => $setting ) {
@@ -796,15 +690,15 @@
796 690 }
797 691
798 692 $_animation = ! empty( $settings['_animation'] );
799 693 $animation = ! empty( $settings['animation'] );
800 - $has_animation = ( $_animation && 'none' !== $settings['_animation'] ) || ( $animation && 'none' !== $settings['animation'] );
694 + $has_animation = $_animation && 'none' !== $settings['_animation'] || $animation && 'none' !== $settings['animation'];
801 695
802 696 if ( $has_animation ) {
803 697 $is_static_render_mode = Plugin::$instance->frontend->is_static_render_mode();
804 698
805 699 if ( ! $is_static_render_mode ) {
806 - // Hide the element until the animation begins.
700 + // Hide the element until the animation begins
807 701 $this->add_render_attribute( '_wrapper', 'class', 'elementor-invisible' );
808 702 }
809 703 }
810 704
@@ -832,15 +726,13 @@
832 726 * Register the Transform controls in the advanced tab of the element.
833 727 *
834 728 * Previously registered under the Widget_Common class, but registered a more fundamental level now to enable access from other widgets.
835 729 *
836 - * @param string $element_selector
837 - * @param string $transform_selector_class
838 - * @return void
839 730 * @since 3.9.0
840 731 * @access protected
732 + * @return void
841 733 */
842 - protected function register_transform_section( $element_selector = '', $transform_selector_class = ' > .elementor-widget-container' ) {
734 + protected function register_transform_section( $element_selector = '' ) {
843 735 $default_unit_values_deg = [];
844 736 $default_unit_values_ms = [];
845 737
846 738 // Set the default unit sizes for all active breakpoints.
@@ -869,8 +761,9 @@
869 761 $this->start_controls_tabs( '_tabs_positioning' );
870 762
871 763 $transform_prefix_class = 'e-';
872 764 $transform_return_value = 'transform';
765 + $transform_selector_class = ' > .elementor-widget-container';
873 766 $transform_css_modifier = '';
874 767
875 768 if ( 'con' === $element_selector ) {
876 769 $transform_selector_class = '.e-' . $element_selector;
@@ -901,9 +794,9 @@
901 794
902 795 $this->add_responsive_control(
903 796 "_transform_rotateZ_effect{$tab}",
904 797 [
905 - 'label' => esc_html__( 'Rotate', 'elementor' ) . ' (deg)',
798 + 'label' => esc_html__( 'Rotate', 'elementor' ),
906 799 'type' => Controls_Manager::SLIDER,
907 800 'device_args' => $default_unit_values_deg,
908 801 'range' => [
909 802 'px' => [
@@ -933,9 +826,8 @@
933 826 ],
934 827 'condition' => [
935 828 "_transform_rotate_popover{$tab}!" => '',
936 829 ],
937 - 'frontend_available' => true,
938 830 ]
939 831 );
940 832
941 833 $this->add_responsive_control(
@@ -940,9 +832,9 @@
940 832
941 833 $this->add_responsive_control(
942 834 "_transform_rotateX_effect{$tab}",
943 835 [
944 - 'label' => esc_html__( 'Rotate X', 'elementor' ) . ' (deg)',
836 + 'label' => esc_html__( 'Rotate X', 'elementor' ),
945 837 'type' => Controls_Manager::SLIDER,
946 838 'device_args' => $default_unit_values_deg,
947 839 'range' => [
948 840 'px' => [
@@ -963,9 +855,9 @@
963 855
964 856 $this->add_responsive_control(
965 857 "_transform_rotateY_effect{$tab}",
966 858 [
967 - 'label' => esc_html__( 'Rotate Y', 'elementor' ) . ' (deg)',
859 + 'label' => esc_html__( 'Rotate Y', 'elementor' ),
968 860 'type' => Controls_Manager::SLIDER,
969 861 'device_args' => $default_unit_values_deg,
970 862 'range' => [
971 863 'px' => [
@@ -986,12 +878,13 @@
986 878
987 879 $this->add_responsive_control(
988 880 "_transform_perspective_effect{$tab}",
989 881 [
990 - 'label' => esc_html__( 'Perspective', 'elementor' ) . ' (px)',
882 + 'label' => esc_html__( 'Perspective', 'elementor' ),
991 883 'type' => Controls_Manager::SLIDER,
992 884 'range' => [
993 885 'px' => [
886 + 'min' => 0,
994 887 'max' => 1000,
995 888 ],
996 889 ],
997 890 'condition' => [
@@ -1023,9 +916,9 @@
1023 916 "_transform_translateX_effect{$tab}",
1024 917 [
1025 918 'label' => esc_html__( 'Offset X', 'elementor' ),
1026 919 'type' => Controls_Manager::SLIDER,
1027 - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
920 + 'size_units' => [ '%', 'px' ],
1028 921 'range' => [
1029 922 '%' => [
1030 923 'min' => -100,
1031 924 'max' => 100,
@@ -1049,9 +942,9 @@
1049 942 "_transform_translateY_effect{$tab}",
1050 943 [
1051 944 'label' => esc_html__( 'Offset Y', 'elementor' ),
1052 945 'type' => Controls_Manager::SLIDER,
1053 - 'size_units' => [ 'px', '%', 'em', 'rem', 'vh', 'custom' ],
946 + 'size_units' => [ '%', 'px' ],
1054 947 'range' => [
1055 948 '%' => [
1056 949 'min' => -100,
1057 950 'max' => 100,
@@ -1102,8 +995,9 @@
1102 995 'label' => esc_html__( 'Scale', 'elementor' ),
1103 996 'type' => Controls_Manager::SLIDER,
1104 997 'range' => [
1105 998 'px' => [
999 + 'min' => 0,
1106 1000 'max' => 2,
1107 1001 'step' => 0.1,
1108 1002 ],
1109 1003 ],
@@ -1124,8 +1018,9 @@
1124 1018 'label' => esc_html__( 'Scale X', 'elementor' ),
1125 1019 'type' => Controls_Manager::SLIDER,
1126 1020 'range' => [
1127 1021 'px' => [
1022 + 'min' => 0,
1128 1023 'max' => 2,
1129 1024 'step' => 0.1,
1130 1025 ],
1131 1026 ],
@@ -1146,8 +1041,9 @@
1146 1041 'label' => esc_html__( 'Scale Y', 'elementor' ),
1147 1042 'type' => Controls_Manager::SLIDER,
1148 1043 'range' => [
1149 1044 'px' => [
1045 + 'min' => 0,
1150 1046 'max' => 2,
1151 1047 'step' => 0.1,
1152 1048 ],
1153 1049 ],
@@ -1178,9 +1074,9 @@
1178 1074
1179 1075 $this->add_responsive_control(
1180 1076 "_transform_skewX_effect{$tab}",
1181 1077 [
1182 - 'label' => esc_html__( 'Skew X', 'elementor' ) . ' (deg)',
1078 + 'label' => esc_html__( 'Skew X', 'elementor' ),
1183 1079 'type' => Controls_Manager::SLIDER,
1184 1080 'device_args' => $default_unit_values_deg,
1185 1081 'range' => [
1186 1082 'px' => [
@@ -1200,9 +1096,9 @@
1200 1096
1201 1097 $this->add_responsive_control(
1202 1098 "_transform_skewY_effect{$tab}",
1203 1099 [
1204 - 'label' => esc_html__( 'Skew Y', 'elementor' ) . ' (deg)',
1100 + 'label' => esc_html__( 'Skew Y', 'elementor' ),
1205 1101 'type' => Controls_Manager::SLIDER,
1206 1102 'device_args' => $default_unit_values_deg,
1207 1103 'range' => [
1208 1104 'px' => [
@@ -1263,16 +1159,15 @@
1263 1159 if ( '_hover' === $tab ) {
1264 1160 $this->add_control(
1265 1161 '_transform_transition_hover',
1266 1162 [
1267 - 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (ms)',
1163 + 'label' => esc_html__( 'Transition Duration (ms)', 'elementor' ),
1268 1164 'type' => Controls_Manager::SLIDER,
1269 1165 'device_args' => $default_unit_values_ms,
1270 1166 'range' => [
1271 1167 'px' => [
1272 - 'min' => 0,
1168 + 'min' => 100,
1273 1169 'max' => 10000,
1274 - 'step' => 100,
1275 1170 ],
1276 1171 ],
1277 1172 'selectors' => [
1278 1173 '{{WRAPPER}}' => '--e-' . $transform_css_modifier . 'transform-transition-duration: {{SIZE}}ms',
@@ -1313,9 +1208,9 @@
1313 1208 'relation' => 'or',
1314 1209 'terms' => array_merge( $transform_origin_conditions, $transform_origin_conditions_hover ),
1315 1210 ];
1316 1211
1317 - // Will override motion effect transform-origin.
1212 + // Will override motion effect transform-origin
1318 1213 $this->add_responsive_control(
1319 1214 'motion_fx_transform_x_anchor_point',
1320 1215 [
1321 1216 'label' => esc_html__( 'X Anchor Point', 'elementor' ),
@@ -1341,9 +1236,9 @@
1341 1236 ],
1342 1237 ]
1343 1238 );
1344 1239
1345 - // Will override motion effect transform-origin.
1240 + // Will override motion effect transform-origin
1346 1241 $this->add_responsive_control(
1347 1242 'motion_fx_transform_y_anchor_point',
1348 1243 [
1349 1244 'label' => esc_html__( 'Y Anchor Point', 'elementor' ),
@@ -1390,13 +1285,10 @@
1390 1285
1391 1286 $this->add_control(
1392 1287 'hide_' . $breakpoint_key,
1393 1288 [
1394 - 'label' => sprintf(
1395 - /* translators: %s: Device name. */
1396 - esc_html__( 'Hide On %s', 'elementor' ),
1397 - $label
1398 - ),
1289 + /* translators: %s: Device name. */
1290 + 'label' => sprintf( __( 'Hide On %s', 'elementor' ), $label ),
1399 1291 'type' => Controls_Manager::SWITCHER,
1400 1292 'default' => '',
1401 1293 'prefix_class' => 'elementor-',
1402 1294 'label_on' => esc_html__( 'Hide', 'elementor' ),
@@ -1434,12 +1326,12 @@
1434 1326 * Output the element final HTML on the frontend.
1435 1327 *
1436 1328 * @since 1.0.0
1437 1329 * @access protected
1438 - * @deprecated 3.1.0 Use `print_content()` method instead.
1330 + * @deprecated 3.1.0
1439 1331 */
1440 1332 protected function _print_content() {
1441 - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0', 'print_content()' );
1333 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0', __CLASS__ . '::print_content()' );
1442 1334
1443 1335 $this->print_content();
1444 1336 }
1445 1337
@@ -1494,11 +1386,8 @@
1494 1386
1495 1387 /**
1496 1388 * A Base method for sanitizing the settings before save.
1497 1389 * This method is meant to be overridden by the element.
1498 - *
1499 - * @param array $settings
1500 - * @return array
1501 1390 */
1502 1391 protected function on_save( array $settings ) {
1503 1392 return $settings;
1504 1393 }
@@ -1517,9 +1406,9 @@
1517 1406 */
1518 1407 private function get_child_type( $element_data ) {
1519 1408 $child_type = $this->_get_default_child_type( $element_data );
1520 1409
1521 - // If it's not a valid widget ( like a deactivated plugin ).
1410 + // If it's not a valid widget ( like a deactivated plugin )
1522 1411 if ( ! $child_type ) {
1523 1412 return false;
1524 1413 }
1525 1414
@@ -1564,12 +1453,8 @@
1564 1453 $this->add_child( $child_data );
1565 1454 }
1566 1455 }
1567 1456
1568 - public function has_widget_inner_wrapper(): bool {
1569 - return true;
1570 - }
1571 -
1572 1457 /**
1573 1458 * Element base constructor.
1574 1459 *
1575 1460 * Initializing the element base class using `$data` and `$args`.
@@ -1582,9 +1467,9 @@
1582 1467 *
1583 1468 * @param array $data Optional. Element data. Default is an empty array.
1584 1469 * @param array|null $args Optional. Element default arguments. Default is null.
1585 1470 **/
1586 - public function __construct( array $data = [], ?array $args = null ) {
1471 + public function __construct( array $data = [], array $args = null ) {
1587 1472 if ( $data ) {
1588 1473 $this->is_type_instance = false;
1589 1474 } elseif ( $args ) {
1590 1475 $this->default_args = $args;