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 -181 4.2.0-dev23.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 *
@@ -326,28 +302,8 @@
326 302
327 303 return $this->children;
328 304 }
329 305
330 - public function render_markdown(): string {
331 - $children = $this->get_children();
332 -
333 - if ( empty( $children ) ) {
334 - return '';
335 - }
336 -
337 - $parts = [];
338 -
339 - foreach ( $children as $child ) {
340 - $md = $child->render_markdown();
341 -
342 - if ( ! empty( trim( $md ) ) ) {
343 - $parts[] = $md;
344 - }
345 - }
346 -
347 - return implode( "\n\n", $parts );
348 - }
349 -
350 306 /**
351 307 * Get default arguments.
352 308 *
353 309 * Retrieve the element default arguments. Used to return all the default
@@ -364,23 +320,8 @@
364 320 return self::get_items( $this->default_args, $item );
365 321 }
366 322
367 323 /**
368 - * Get panel presets.
369 - *
370 - * Used for displaying the widget in the panel multiple times, but with different defaults values,
371 - * icon, title etc.
372 - *
373 - * @since 3.16.0
374 - * @access public
375 - *
376 - * @return array
377 - */
378 - public function get_panel_presets() {
379 - return [];
380 - }
381 -
382 - /**
383 324 * Add new child element.
384 325 *
385 326 * Register new child element to allow hierarchy.
386 327 *
@@ -426,14 +367,15 @@
426 367 * @since 2.8.0
427 368 * @access public
428 369 *
429 370 * @param array|string $element The HTML element.
430 - * @param array $url_control Array of link settings.
431 - * @param bool $overwrite Optional. Whether to overwrite existing
432 - * 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.
433 374 *
434 375 * @return Element_Base Current instance of the element.
435 376 */
377 +
436 378 public function add_link_attributes( $element, array $url_control, $overwrite = false ) {
437 379 $attributes = [];
438 380
439 381 if ( ! empty( $url_control['url'] ) ) {
@@ -450,9 +392,9 @@
450 392 $attributes['rel'] = 'nofollow';
451 393 }
452 394
453 395 if ( ! empty( $url_control['custom_attributes'] ) ) {
454 - // 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
455 397 $attributes = array_merge( $attributes, Utils::parse_custom_attributes( $url_control['custom_attributes'] ) );
456 398 }
457 399
458 400 if ( $attributes ) {
@@ -461,16 +403,8 @@
461 403
462 404 return $this;
463 405 }
464 406
465 - public function reset_descendant_render_state(): void {
466 - $this->reset_render_state();
467 -
468 - foreach ( $this->get_children() as $child ) {
469 - $child->reset_descendant_render_state();
470 - }
471 - }
472 -
473 407 /**
474 408 * Print element.
475 409 *
476 410 * Used to generate the element final HTML on the frontend and the editor.
@@ -480,15 +414,8 @@
480 414 */
481 415 public function print_element() {
482 416 $element_type = $this->get_type();
483 417
484 - if ( $this->should_render_shortcode() ) {
485 - $unique_id = apply_filters( 'elementor/element_cache/unique_id', '' );
486 -
487 - echo '[elementor-element k="' . esc_attr( $unique_id ) . '" data="' . esc_attr( base64_encode( wp_json_encode( $this->get_raw_data() ) ) ) . '"]';
488 - return;
489 - }
490 -
491 418 /**
492 419 * Before frontend element render.
493 420 *
494 421 * Fires before Elementor element is rendered in the frontend.
@@ -551,10 +478,8 @@
551 478 // PHPCS - The content has already been escaped by the `render` method.
552 479 echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
553 480 $this->after_render();
554 481
555 - // TODO: Remove this in the future
556 - // Since version 3.24.0 page scripts/styles are handled by `page_assets`.
557 482 $this->enqueue_scripts();
558 483 $this->enqueue_styles();
559 484 }
560 485
@@ -582,54 +507,8 @@
582 507 */
583 508 do_action( 'elementor/frontend/after_render', $this );
584 509 }
585 510
586 - protected function should_render_shortcode() {
587 - $should_render_shortcode = apply_filters( 'elementor/element/should_render_shortcode', false );
588 -
589 - if ( ! $should_render_shortcode ) {
590 - return false;
591 - }
592 -
593 - $raw_data = $this->get_raw_data();
594 -
595 - if ( ! empty( $raw_data['settings']['_element_cache'] ) ) {
596 - return 'yes' === $raw_data['settings']['_element_cache'];
597 - }
598 -
599 - if ( $this->is_dynamic_content() ) {
600 - return true;
601 - }
602 -
603 - $is_dynamic_content = apply_filters( 'elementor/element/is_dynamic_content', false, $raw_data, $this );
604 -
605 - $has_dynamic_tag = $this->has_element_dynamic_tag( $raw_data['settings'] );
606 -
607 - if ( $is_dynamic_content || $has_dynamic_tag ) {
608 - return true;
609 - }
610 -
611 - return false;
612 - }
613 -
614 - private function has_element_dynamic_tag( $element_settings ): bool {
615 - if ( is_array( $element_settings ) ) {
616 - if ( ! empty( $element_settings['__dynamic__'] ) ) {
617 - return true;
618 - }
619 -
620 - foreach ( $element_settings as $value ) {
621 - $has_dynamic = $this->has_element_dynamic_tag( $value );
622 -
623 - if ( $has_dynamic ) {
624 - return true;
625 - }
626 - }
627 - }
628 -
629 - return false;
630 - }
631 -
632 511 /**
633 512 * Get the element raw data.
634 513 *
635 514 * Retrieve the raw element data, including the id, type, settings, child
@@ -656,9 +535,9 @@
656 535 foreach ( $this->get_children() as $child ) {
657 536 $elements[] = $child->get_raw_data( $with_html_content );
658 537 }
659 538
660 - $raw_data = [
539 + return [
661 540 'id' => $this->get_id(),
662 541 'elType' => $data['elType'],
663 542 'settings' => $data['settings'],
664 543 'elements' => $elements,
@@ -663,14 +542,8 @@
663 542 'settings' => $data['settings'],
664 543 'elements' => $elements,
665 544 'isInner' => $data['isInner'],
666 545 ];
667 -
668 - if ( ! empty( $data['isLocked'] ) ) {
669 - $raw_data['isLocked'] = $data['isLocked'];
670 - }
671 -
672 - return $raw_data;
673 546 }
674 547
675 548 public function get_data_for_save() {
676 549 $data = $this->get_raw_data();
@@ -732,9 +605,9 @@
732 605 * @param array|null $controls The available controls.
733 606 *
734 607 * @return array Element data.
735 608 */
736 - 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 {
737 610 $tags_manager = Plugin::$instance->dynamic_tags;
738 611
739 612 if ( empty( $config['settings'][ $tags_manager::DYNAMIC_SETTING_KEY ] ) ) {
740 613 return $config;
@@ -767,12 +640,12 @@
767 640 * Used to add attributes to the current element wrapper HTML tag.
768 641 *
769 642 * @since 1.3.0
770 643 * @access protected
771 - * @deprecated 3.1.0 Use `add_render_attribute()` method instead.
644 + * @deprecated 3.1.0
772 645 */
773 646 protected function _add_render_attributes() {
774 - 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()' );
775 648
776 649 return $this->add_render_attributes();
777 650 }
778 651
@@ -797,9 +670,8 @@
797 670 'elementor-element-' . $id,
798 671 ],
799 672 'data-id' => $id,
800 673 'data-element_type' => $this->get_type(),
801 - 'data-e-type' => $this->get_type(),
802 674 ] );
803 675
804 676 $class_settings = [];
805 677
@@ -804,15 +676,9 @@
804 676 $class_settings = [];
805 677
806 678 foreach ( $settings as $setting_key => $setting ) {
807 679 if ( isset( $controls[ $setting_key ]['prefix_class'] ) ) {
808 - if ( isset( $controls[ $setting_key ]['classes_dictionary'][ $setting ] ) ) {
809 - $value = $controls[ $setting_key ]['classes_dictionary'][ $setting ];
810 - } else {
811 - $value = $setting;
812 - }
813 -
814 - $class_settings[ $setting_key ] = $value;
680 + $class_settings[ $setting_key ] = $setting;
815 681 }
816 682 }
817 683
818 684 foreach ( $class_settings as $setting_key => $setting ) {
@@ -824,15 +690,15 @@
824 690 }
825 691
826 692 $_animation = ! empty( $settings['_animation'] );
827 693 $animation = ! empty( $settings['animation'] );
828 - $has_animation = ( $_animation && 'none' !== $settings['_animation'] ) || ( $animation && 'none' !== $settings['animation'] );
694 + $has_animation = $_animation && 'none' !== $settings['_animation'] || $animation && 'none' !== $settings['animation'];
829 695
830 696 if ( $has_animation ) {
831 697 $is_static_render_mode = Plugin::$instance->frontend->is_static_render_mode();
832 698
833 699 if ( ! $is_static_render_mode ) {
834 - // Hide the element until the animation begins.
700 + // Hide the element until the animation begins
835 701 $this->add_render_attribute( '_wrapper', 'class', 'elementor-invisible' );
836 702 }
837 703 }
838 704
@@ -860,15 +726,13 @@
860 726 * Register the Transform controls in the advanced tab of the element.
861 727 *
862 728 * Previously registered under the Widget_Common class, but registered a more fundamental level now to enable access from other widgets.
863 729 *
864 - * @param string $element_selector
865 - * @param string $transform_selector_class
866 - * @return void
867 730 * @since 3.9.0
868 731 * @access protected
732 + * @return void
869 733 */
870 - protected function register_transform_section( $element_selector = '', $transform_selector_class = ' > .elementor-widget-container' ) {
734 + protected function register_transform_section( $element_selector = '' ) {
871 735 $default_unit_values_deg = [];
872 736 $default_unit_values_ms = [];
873 737
874 738 // Set the default unit sizes for all active breakpoints.
@@ -897,8 +761,9 @@
897 761 $this->start_controls_tabs( '_tabs_positioning' );
898 762
899 763 $transform_prefix_class = 'e-';
900 764 $transform_return_value = 'transform';
765 + $transform_selector_class = ' > .elementor-widget-container';
901 766 $transform_css_modifier = '';
902 767
903 768 if ( 'con' === $element_selector ) {
904 769 $transform_selector_class = '.e-' . $element_selector;
@@ -929,9 +794,9 @@
929 794
930 795 $this->add_responsive_control(
931 796 "_transform_rotateZ_effect{$tab}",
932 797 [
933 - 'label' => esc_html__( 'Rotate', 'elementor' ) . ' (deg)',
798 + 'label' => esc_html__( 'Rotate', 'elementor' ),
934 799 'type' => Controls_Manager::SLIDER,
935 800 'device_args' => $default_unit_values_deg,
936 801 'range' => [
937 802 'px' => [
@@ -961,9 +826,8 @@
961 826 ],
962 827 'condition' => [
963 828 "_transform_rotate_popover{$tab}!" => '',
964 829 ],
965 - 'frontend_available' => true,
966 830 ]
967 831 );
968 832
969 833 $this->add_responsive_control(
@@ -968,9 +832,9 @@
968 832
969 833 $this->add_responsive_control(
970 834 "_transform_rotateX_effect{$tab}",
971 835 [
972 - 'label' => esc_html__( 'Rotate X', 'elementor' ) . ' (deg)',
836 + 'label' => esc_html__( 'Rotate X', 'elementor' ),
973 837 'type' => Controls_Manager::SLIDER,
974 838 'device_args' => $default_unit_values_deg,
975 839 'range' => [
976 840 'px' => [
@@ -991,9 +855,9 @@
991 855
992 856 $this->add_responsive_control(
993 857 "_transform_rotateY_effect{$tab}",
994 858 [
995 - 'label' => esc_html__( 'Rotate Y', 'elementor' ) . ' (deg)',
859 + 'label' => esc_html__( 'Rotate Y', 'elementor' ),
996 860 'type' => Controls_Manager::SLIDER,
997 861 'device_args' => $default_unit_values_deg,
998 862 'range' => [
999 863 'px' => [
@@ -1014,12 +878,13 @@
1014 878
1015 879 $this->add_responsive_control(
1016 880 "_transform_perspective_effect{$tab}",
1017 881 [
1018 - 'label' => esc_html__( 'Perspective', 'elementor' ) . ' (px)',
882 + 'label' => esc_html__( 'Perspective', 'elementor' ),
1019 883 'type' => Controls_Manager::SLIDER,
1020 884 'range' => [
1021 885 'px' => [
886 + 'min' => 0,
1022 887 'max' => 1000,
1023 888 ],
1024 889 ],
1025 890 'condition' => [
@@ -1051,9 +916,9 @@
1051 916 "_transform_translateX_effect{$tab}",
1052 917 [
1053 918 'label' => esc_html__( 'Offset X', 'elementor' ),
1054 919 'type' => Controls_Manager::SLIDER,
1055 - 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ],
920 + 'size_units' => [ '%', 'px' ],
1056 921 'range' => [
1057 922 '%' => [
1058 923 'min' => -100,
1059 924 'max' => 100,
@@ -1077,9 +942,9 @@
1077 942 "_transform_translateY_effect{$tab}",
1078 943 [
1079 944 'label' => esc_html__( 'Offset Y', 'elementor' ),
1080 945 'type' => Controls_Manager::SLIDER,
1081 - 'size_units' => [ 'px', '%', 'em', 'rem', 'vh', 'custom' ],
946 + 'size_units' => [ '%', 'px' ],
1082 947 'range' => [
1083 948 '%' => [
1084 949 'min' => -100,
1085 950 'max' => 100,
@@ -1130,8 +995,9 @@
1130 995 'label' => esc_html__( 'Scale', 'elementor' ),
1131 996 'type' => Controls_Manager::SLIDER,
1132 997 'range' => [
1133 998 'px' => [
999 + 'min' => 0,
1134 1000 'max' => 2,
1135 1001 'step' => 0.1,
1136 1002 ],
1137 1003 ],
@@ -1152,8 +1018,9 @@
1152 1018 'label' => esc_html__( 'Scale X', 'elementor' ),
1153 1019 'type' => Controls_Manager::SLIDER,
1154 1020 'range' => [
1155 1021 'px' => [
1022 + 'min' => 0,
1156 1023 'max' => 2,
1157 1024 'step' => 0.1,
1158 1025 ],
1159 1026 ],
@@ -1174,8 +1041,9 @@
1174 1041 'label' => esc_html__( 'Scale Y', 'elementor' ),
1175 1042 'type' => Controls_Manager::SLIDER,
1176 1043 'range' => [
1177 1044 'px' => [
1045 + 'min' => 0,
1178 1046 'max' => 2,
1179 1047 'step' => 0.1,
1180 1048 ],
1181 1049 ],
@@ -1206,9 +1074,9 @@
1206 1074
1207 1075 $this->add_responsive_control(
1208 1076 "_transform_skewX_effect{$tab}",
1209 1077 [
1210 - 'label' => esc_html__( 'Skew X', 'elementor' ) . ' (deg)',
1078 + 'label' => esc_html__( 'Skew X', 'elementor' ),
1211 1079 'type' => Controls_Manager::SLIDER,
1212 1080 'device_args' => $default_unit_values_deg,
1213 1081 'range' => [
1214 1082 'px' => [
@@ -1228,9 +1096,9 @@
1228 1096
1229 1097 $this->add_responsive_control(
1230 1098 "_transform_skewY_effect{$tab}",
1231 1099 [
1232 - 'label' => esc_html__( 'Skew Y', 'elementor' ) . ' (deg)',
1100 + 'label' => esc_html__( 'Skew Y', 'elementor' ),
1233 1101 'type' => Controls_Manager::SLIDER,
1234 1102 'device_args' => $default_unit_values_deg,
1235 1103 'range' => [
1236 1104 'px' => [
@@ -1291,16 +1159,15 @@
1291 1159 if ( '_hover' === $tab ) {
1292 1160 $this->add_control(
1293 1161 '_transform_transition_hover',
1294 1162 [
1295 - 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (ms)',
1163 + 'label' => esc_html__( 'Transition Duration (ms)', 'elementor' ),
1296 1164 'type' => Controls_Manager::SLIDER,
1297 1165 'device_args' => $default_unit_values_ms,
1298 1166 'range' => [
1299 1167 'px' => [
1300 - 'min' => 0,
1168 + 'min' => 100,
1301 1169 'max' => 10000,
1302 - 'step' => 100,
1303 1170 ],
1304 1171 ],
1305 1172 'selectors' => [
1306 1173 '{{WRAPPER}}' => '--e-' . $transform_css_modifier . 'transform-transition-duration: {{SIZE}}ms',
@@ -1341,9 +1208,9 @@
1341 1208 'relation' => 'or',
1342 1209 'terms' => array_merge( $transform_origin_conditions, $transform_origin_conditions_hover ),
1343 1210 ];
1344 1211
1345 - // Will override motion effect transform-origin.
1212 + // Will override motion effect transform-origin
1346 1213 $this->add_responsive_control(
1347 1214 'motion_fx_transform_x_anchor_point',
1348 1215 [
1349 1216 'label' => esc_html__( 'X Anchor Point', 'elementor' ),
@@ -1369,9 +1236,9 @@
1369 1236 ],
1370 1237 ]
1371 1238 );
1372 1239
1373 - // Will override motion effect transform-origin.
1240 + // Will override motion effect transform-origin
1374 1241 $this->add_responsive_control(
1375 1242 'motion_fx_transform_y_anchor_point',
1376 1243 [
1377 1244 'label' => esc_html__( 'Y Anchor Point', 'elementor' ),
@@ -1418,13 +1285,10 @@
1418 1285
1419 1286 $this->add_control(
1420 1287 'hide_' . $breakpoint_key,
1421 1288 [
1422 - 'label' => sprintf(
1423 - /* translators: %s: Device name. */
1424 - esc_html__( 'Hide On %s', 'elementor' ),
1425 - $label
1426 - ),
1289 + /* translators: %s: Device name. */
1290 + 'label' => sprintf( __( 'Hide On %s', 'elementor' ), $label ),
1427 1291 'type' => Controls_Manager::SWITCHER,
1428 1292 'default' => '',
1429 1293 'prefix_class' => 'elementor-',
1430 1294 'label_on' => esc_html__( 'Hide', 'elementor' ),
@@ -1462,12 +1326,12 @@
1462 1326 * Output the element final HTML on the frontend.
1463 1327 *
1464 1328 * @since 1.0.0
1465 1329 * @access protected
1466 - * @deprecated 3.1.0 Use `print_content()` method instead.
1330 + * @deprecated 3.1.0
1467 1331 */
1468 1332 protected function _print_content() {
1469 - 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()' );
1470 1334
1471 1335 $this->print_content();
1472 1336 }
1473 1337
@@ -1522,11 +1386,8 @@
1522 1386
1523 1387 /**
1524 1388 * A Base method for sanitizing the settings before save.
1525 1389 * This method is meant to be overridden by the element.
1526 - *
1527 - * @param array $settings
1528 - * @return array
1529 1390 */
1530 1391 protected function on_save( array $settings ) {
1531 1392 return $settings;
1532 1393 }
@@ -1545,9 +1406,9 @@
1545 1406 */
1546 1407 private function get_child_type( $element_data ) {
1547 1408 $child_type = $this->_get_default_child_type( $element_data );
1548 1409
1549 - // If it's not a valid widget ( like a deactivated plugin ).
1410 + // If it's not a valid widget ( like a deactivated plugin )
1550 1411 if ( ! $child_type ) {
1551 1412 return false;
1552 1413 }
1553 1414
@@ -1592,12 +1453,8 @@
1592 1453 $this->add_child( $child_data );
1593 1454 }
1594 1455 }
1595 1456
1596 - public function has_widget_inner_wrapper(): bool {
1597 - return true;
1598 - }
1599 -
1600 1457 /**
1601 1458 * Element base constructor.
1602 1459 *
1603 1460 * Initializing the element base class using `$data` and `$args`.
@@ -1610,9 +1467,9 @@
1610 1467 *
1611 1468 * @param array $data Optional. Element data. Default is an empty array.
1612 1469 * @param array|null $args Optional. Element default arguments. Default is null.
1613 1470 **/
1614 - public function __construct( array $data = [], ?array $args = null ) {
1471 + public function __construct( array $data = [], array $args = null ) {
1615 1472 if ( $data ) {
1616 1473 $this->is_type_instance = false;
1617 1474 } elseif ( $args ) {
1618 1475 $this->default_args = $args;