PluginProbe
Elementor Website Builder – more than just a page builder / 3.13.3
Elementor Website Builder – more than just a page builder v3.13.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/base/element-base.php +34 -163 4.1.43.13.3 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 ) {
@@ -472,15 +414,8 @@
472 414 */
473 415 public function print_element() {
474 416 $element_type = $this->get_type();
475 417
476 - if ( $this->should_render_shortcode() ) {
477 - $unique_id = apply_filters( 'elementor/element_cache/unique_id', '' );
478 -
479 - echo '[elementor-element k="' . esc_attr( $unique_id ) . '" data="' . esc_attr( base64_encode( wp_json_encode( $this->get_raw_data() ) ) ) . '"]';
480 - return;
481 - }
482 -
483 418 /**
484 419 * Before frontend element render.
485 420 *
486 421 * Fires before Elementor element is rendered in the frontend.
@@ -543,10 +478,8 @@
543 478 // PHPCS - The content has already been escaped by the `render` method.
544 479 echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
545 480 $this->after_render();
546 481
547 - // TODO: Remove this in the future
548 - // Since version 3.24.0 page scripts/styles are handled by `page_assets`.
549 482 $this->enqueue_scripts();
550 483 $this->enqueue_styles();
551 484 }
552 485
@@ -574,54 +507,8 @@
574 507 */
575 508 do_action( 'elementor/frontend/after_render', $this );
576 509 }
577 510
578 - protected function should_render_shortcode() {
579 - $should_render_shortcode = apply_filters( 'elementor/element/should_render_shortcode', false );
580 -
581 - if ( ! $should_render_shortcode ) {
582 - return false;
583 - }
584 -
585 - $raw_data = $this->get_raw_data();
586 -
587 - if ( ! empty( $raw_data['settings']['_element_cache'] ) ) {
588 - return 'yes' === $raw_data['settings']['_element_cache'];
589 - }
590 -
591 - if ( $this->is_dynamic_content() ) {
592 - return true;
593 - }
594 -
595 - $is_dynamic_content = apply_filters( 'elementor/element/is_dynamic_content', false, $raw_data, $this );
596 -
597 - $has_dynamic_tag = $this->has_element_dynamic_tag( $raw_data['settings'] );
598 -
599 - if ( $is_dynamic_content || $has_dynamic_tag ) {
600 - return true;
601 - }
602 -
603 - return false;
604 - }
605 -
606 - private function has_element_dynamic_tag( $element_settings ): bool {
607 - if ( is_array( $element_settings ) ) {
608 - if ( ! empty( $element_settings['__dynamic__'] ) ) {
609 - return true;
610 - }
611 -
612 - foreach ( $element_settings as $value ) {
613 - $has_dynamic = $this->has_element_dynamic_tag( $value );
614 -
615 - if ( $has_dynamic ) {
616 - return true;
617 - }
618 - }
619 - }
620 -
621 - return false;
622 - }
623 -
624 511 /**
625 512 * Get the element raw data.
626 513 *
627 514 * Retrieve the raw element data, including the id, type, settings, child
@@ -724,9 +611,9 @@
724 611 * @param array|null $controls The available controls.
725 612 *
726 613 * @return array Element data.
727 614 */
728 - public static function on_import_update_dynamic_content( array $config, array $data, $controls = null ): array {
615 + public static function on_import_update_dynamic_content( array $config, array $data, $controls = null ) : array {
729 616 $tags_manager = Plugin::$instance->dynamic_tags;
730 617
731 618 if ( empty( $config['settings'][ $tags_manager::DYNAMIC_SETTING_KEY ] ) ) {
732 619 return $config;
@@ -759,12 +646,12 @@
759 646 * Used to add attributes to the current element wrapper HTML tag.
760 647 *
761 648 * @since 1.3.0
762 649 * @access protected
763 - * @deprecated 3.1.0 Use `add_render_attribute()` method instead.
650 + * @deprecated 3.1.0
764 651 */
765 652 protected function _add_render_attributes() {
766 - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0', 'add_render_attributes()' );
653 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0', __CLASS__ . '::add_render_attributes()' );
767 654
768 655 return $this->add_render_attributes();
769 656 }
770 657
@@ -789,9 +676,8 @@
789 676 'elementor-element-' . $id,
790 677 ],
791 678 'data-id' => $id,
792 679 'data-element_type' => $this->get_type(),
793 - 'data-e-type' => $this->get_type(),
794 680 ] );
795 681
796 682 $class_settings = [];
797 683
@@ -796,15 +682,9 @@
796 682 $class_settings = [];
797 683
798 684 foreach ( $settings as $setting_key => $setting ) {
799 685 if ( isset( $controls[ $setting_key ]['prefix_class'] ) ) {
800 - if ( isset( $controls[ $setting_key ]['classes_dictionary'][ $setting ] ) ) {
801 - $value = $controls[ $setting_key ]['classes_dictionary'][ $setting ];
802 - } else {
803 - $value = $setting;
804 - }
805 -
806 - $class_settings[ $setting_key ] = $value;
686 + $class_settings[ $setting_key ] = $setting;
807 687 }
808 688 }
809 689
810 690 foreach ( $class_settings as $setting_key => $setting ) {
@@ -816,15 +696,15 @@
816 696 }
817 697
818 698 $_animation = ! empty( $settings['_animation'] );
819 699 $animation = ! empty( $settings['animation'] );
820 - $has_animation = ( $_animation && 'none' !== $settings['_animation'] ) || ( $animation && 'none' !== $settings['animation'] );
700 + $has_animation = $_animation && 'none' !== $settings['_animation'] || $animation && 'none' !== $settings['animation'];
821 701
822 702 if ( $has_animation ) {
823 703 $is_static_render_mode = Plugin::$instance->frontend->is_static_render_mode();
824 704
825 705 if ( ! $is_static_render_mode ) {
826 - // Hide the element until the animation begins.
706 + // Hide the element until the animation begins
827 707 $this->add_render_attribute( '_wrapper', 'class', 'elementor-invisible' );
828 708 }
829 709 }
830 710
@@ -852,15 +732,13 @@
852 732 * Register the Transform controls in the advanced tab of the element.
853 733 *
854 734 * Previously registered under the Widget_Common class, but registered a more fundamental level now to enable access from other widgets.
855 735 *
856 - * @param string $element_selector
857 - * @param string $transform_selector_class
858 - * @return void
859 736 * @since 3.9.0
860 737 * @access protected
738 + * @return void
861 739 */
862 - protected function register_transform_section( $element_selector = '', $transform_selector_class = ' > .elementor-widget-container' ) {
740 + protected function register_transform_section( $element_selector = '' ) {
863 741 $default_unit_values_deg = [];
864 742 $default_unit_values_ms = [];
865 743
866 744 // Set the default unit sizes for all active breakpoints.
@@ -889,8 +767,9 @@
889 767 $this->start_controls_tabs( '_tabs_positioning' );
890 768
891 769 $transform_prefix_class = 'e-';
892 770 $transform_return_value = 'transform';
771 + $transform_selector_class = ' > .elementor-widget-container';
893 772 $transform_css_modifier = '';
894 773
895 774 if ( 'con' === $element_selector ) {
896 775 $transform_selector_class = '.e-' . $element_selector;
@@ -921,9 +800,9 @@
921 800
922 801 $this->add_responsive_control(
923 802 "_transform_rotateZ_effect{$tab}",
924 803 [
925 - 'label' => esc_html__( 'Rotate', 'elementor' ) . ' (deg)',
804 + 'label' => esc_html__( 'Rotate', 'elementor' ),
926 805 'type' => Controls_Manager::SLIDER,
927 806 'device_args' => $default_unit_values_deg,
928 807 'range' => [
929 808 'px' => [
@@ -953,9 +832,8 @@
953 832 ],
954 833 'condition' => [
955 834 "_transform_rotate_popover{$tab}!" => '',
956 835 ],
957 - 'frontend_available' => true,
958 836 ]
959 837 );
960 838
961 839 $this->add_responsive_control(
@@ -960,9 +838,9 @@
960 838
961 839 $this->add_responsive_control(
962 840 "_transform_rotateX_effect{$tab}",
963 841 [
964 - 'label' => esc_html__( 'Rotate X', 'elementor' ) . ' (deg)',
842 + 'label' => esc_html__( 'Rotate X', 'elementor' ),
965 843 'type' => Controls_Manager::SLIDER,
966 844 'device_args' => $default_unit_values_deg,
967 845 'range' => [
968 846 'px' => [
@@ -983,9 +861,9 @@
983 861
984 862 $this->add_responsive_control(
985 863 "_transform_rotateY_effect{$tab}",
986 864 [
987 - 'label' => esc_html__( 'Rotate Y', 'elementor' ) . ' (deg)',
865 + 'label' => esc_html__( 'Rotate Y', 'elementor' ),
988 866 'type' => Controls_Manager::SLIDER,
989 867 'device_args' => $default_unit_values_deg,
990 868 'range' => [
991 869 'px' => [
@@ -1006,12 +884,13 @@
1006 884
1007 885 $this->add_responsive_control(
1008 886 "_transform_perspective_effect{$tab}",
1009 887 [
1010 - 'label' => esc_html__( 'Perspective', 'elementor' ) . ' (px)',
888 + 'label' => esc_html__( 'Perspective', 'elementor' ),
1011 889 'type' => Controls_Manager::SLIDER,
1012 890 'range' => [
1013 891 'px' => [
892 + 'min' => 0,
1014 893 'max' => 1000,
1015 894 ],
1016 895 ],
1017 896 'condition' => [
@@ -1122,8 +1001,9 @@
1122 1001 'label' => esc_html__( 'Scale', 'elementor' ),
1123 1002 'type' => Controls_Manager::SLIDER,
1124 1003 'range' => [
1125 1004 'px' => [
1005 + 'min' => 0,
1126 1006 'max' => 2,
1127 1007 'step' => 0.1,
1128 1008 ],
1129 1009 ],
@@ -1144,8 +1024,9 @@
1144 1024 'label' => esc_html__( 'Scale X', 'elementor' ),
1145 1025 'type' => Controls_Manager::SLIDER,
1146 1026 'range' => [
1147 1027 'px' => [
1028 + 'min' => 0,
1148 1029 'max' => 2,
1149 1030 'step' => 0.1,
1150 1031 ],
1151 1032 ],
@@ -1166,8 +1047,9 @@
1166 1047 'label' => esc_html__( 'Scale Y', 'elementor' ),
1167 1048 'type' => Controls_Manager::SLIDER,
1168 1049 'range' => [
1169 1050 'px' => [
1051 + 'min' => 0,
1170 1052 'max' => 2,
1171 1053 'step' => 0.1,
1172 1054 ],
1173 1055 ],
@@ -1198,9 +1080,9 @@
1198 1080
1199 1081 $this->add_responsive_control(
1200 1082 "_transform_skewX_effect{$tab}",
1201 1083 [
1202 - 'label' => esc_html__( 'Skew X', 'elementor' ) . ' (deg)',
1084 + 'label' => esc_html__( 'Skew X', 'elementor' ),
1203 1085 'type' => Controls_Manager::SLIDER,
1204 1086 'device_args' => $default_unit_values_deg,
1205 1087 'range' => [
1206 1088 'px' => [
@@ -1220,9 +1102,9 @@
1220 1102
1221 1103 $this->add_responsive_control(
1222 1104 "_transform_skewY_effect{$tab}",
1223 1105 [
1224 - 'label' => esc_html__( 'Skew Y', 'elementor' ) . ' (deg)',
1106 + 'label' => esc_html__( 'Skew Y', 'elementor' ),
1225 1107 'type' => Controls_Manager::SLIDER,
1226 1108 'device_args' => $default_unit_values_deg,
1227 1109 'range' => [
1228 1110 'px' => [
@@ -1288,11 +1170,10 @@
1288 1170 'type' => Controls_Manager::SLIDER,
1289 1171 'device_args' => $default_unit_values_ms,
1290 1172 'range' => [
1291 1173 'px' => [
1292 - 'min' => 0,
1174 + 'min' => 100,
1293 1175 'max' => 10000,
1294 - 'step' => 100,
1295 1176 ],
1296 1177 ],
1297 1178 'selectors' => [
1298 1179 '{{WRAPPER}}' => '--e-' . $transform_css_modifier . 'transform-transition-duration: {{SIZE}}ms',
@@ -1333,9 +1214,9 @@
1333 1214 'relation' => 'or',
1334 1215 'terms' => array_merge( $transform_origin_conditions, $transform_origin_conditions_hover ),
1335 1216 ];
1336 1217
1337 - // Will override motion effect transform-origin.
1218 + // Will override motion effect transform-origin
1338 1219 $this->add_responsive_control(
1339 1220 'motion_fx_transform_x_anchor_point',
1340 1221 [
1341 1222 'label' => esc_html__( 'X Anchor Point', 'elementor' ),
@@ -1361,9 +1242,9 @@
1361 1242 ],
1362 1243 ]
1363 1244 );
1364 1245
1365 - // Will override motion effect transform-origin.
1246 + // Will override motion effect transform-origin
1366 1247 $this->add_responsive_control(
1367 1248 'motion_fx_transform_y_anchor_point',
1368 1249 [
1369 1250 'label' => esc_html__( 'Y Anchor Point', 'elementor' ),
@@ -1410,13 +1291,10 @@
1410 1291
1411 1292 $this->add_control(
1412 1293 'hide_' . $breakpoint_key,
1413 1294 [
1414 - 'label' => sprintf(
1415 - /* translators: %s: Device name. */
1416 - esc_html__( 'Hide On %s', 'elementor' ),
1417 - $label
1418 - ),
1295 + /* translators: %s: Device name. */
1296 + 'label' => sprintf( __( 'Hide On %s', 'elementor' ), $label ),
1419 1297 'type' => Controls_Manager::SWITCHER,
1420 1298 'default' => '',
1421 1299 'prefix_class' => 'elementor-',
1422 1300 'label_on' => esc_html__( 'Hide', 'elementor' ),
@@ -1454,12 +1332,12 @@
1454 1332 * Output the element final HTML on the frontend.
1455 1333 *
1456 1334 * @since 1.0.0
1457 1335 * @access protected
1458 - * @deprecated 3.1.0 Use `print_content()` method instead.
1336 + * @deprecated 3.1.0
1459 1337 */
1460 1338 protected function _print_content() {
1461 - Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0', 'print_content()' );
1339 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0', __CLASS__ . '::print_content()' );
1462 1340
1463 1341 $this->print_content();
1464 1342 }
1465 1343
@@ -1514,11 +1392,8 @@
1514 1392
1515 1393 /**
1516 1394 * A Base method for sanitizing the settings before save.
1517 1395 * This method is meant to be overridden by the element.
1518 - *
1519 - * @param array $settings
1520 - * @return array
1521 1396 */
1522 1397 protected function on_save( array $settings ) {
1523 1398 return $settings;
1524 1399 }
@@ -1537,9 +1412,9 @@
1537 1412 */
1538 1413 private function get_child_type( $element_data ) {
1539 1414 $child_type = $this->_get_default_child_type( $element_data );
1540 1415
1541 - // If it's not a valid widget ( like a deactivated plugin ).
1416 + // If it's not a valid widget ( like a deactivated plugin )
1542 1417 if ( ! $child_type ) {
1543 1418 return false;
1544 1419 }
1545 1420
@@ -1584,12 +1459,8 @@
1584 1459 $this->add_child( $child_data );
1585 1460 }
1586 1461 }
1587 1462
1588 - public function has_widget_inner_wrapper(): bool {
1589 - return true;
1590 - }
1591 -
1592 1463 /**
1593 1464 * Element base constructor.
1594 1465 *
1595 1466 * Initializing the element base class using `$data` and `$args`.
@@ -1602,9 +1473,9 @@
1602 1473 *
1603 1474 * @param array $data Optional. Element data. Default is an empty array.
1604 1475 * @param array|null $args Optional. Element default arguments. Default is null.
1605 1476 **/
1606 - public function __construct( array $data = [], ?array $args = null ) {
1477 + public function __construct( array $data = [], array $args = null ) {
1607 1478 if ( $data ) {
1608 1479 $this->is_type_instance = false;
1609 1480 } elseif ( $args ) {
1610 1481 $this->default_args = $args;