PluginProbe
Elementor Website Builder – more than just a page builder / 3.22.0-beta1
Elementor Website Builder – more than just a page builder v3.22.0-beta1
4.3.4 4.3.3 4.3.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 All 457 releases
← All changes | includes/base/element-base.php +23 -82 4.1.4 → 3.22.0-beta1 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.
@@ -297,9 +287,9 @@
297 287
298 288 /**
299 289 * Whether the element returns dynamic content.
300 290 *
301 - * Set to determine whether to cache the element output or not.
291 + * set to determine whether to cache the element output or not.
302 292 *
303 293 * @since 3.22.0
304 294 * @access protected
305 295 *
@@ -326,28 +316,8 @@
326 316
327 317 return $this->children;
328 318 }
329 319
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 320 /**
351 321 * Get default arguments.
352 322 *
353 323 * Retrieve the element default arguments. Used to return all the default
@@ -426,14 +396,15 @@
426 396 * @since 2.8.0
427 397 * @access public
428 398 *
429 399 * @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.
400 + * @param array $url_control Array of link settings.
401 + * @param bool $overwrite Optional. Whether to overwrite existing
402 + * attribute. Default is false, not to overwrite.
433 403 *
434 404 * @return Element_Base Current instance of the element.
435 405 */
406 +
436 407 public function add_link_attributes( $element, array $url_control, $overwrite = false ) {
437 408 $attributes = [];
438 409
439 410 if ( ! empty( $url_control['url'] ) ) {
@@ -450,9 +421,9 @@
450 421 $attributes['rel'] = 'nofollow';
451 422 }
452 423
453 424 if ( ! empty( $url_control['custom_attributes'] ) ) {
454 - // Custom URL attributes should come as a string of comma-delimited key|value pairs.
425 + // Custom URL attributes should come as a string of comma-delimited key|value pairs
455 426 $attributes = array_merge( $attributes, Utils::parse_custom_attributes( $url_control['custom_attributes'] ) );
456 427 }
457 428
458 429 if ( $attributes ) {
@@ -473,11 +444,9 @@
473 444 public function print_element() {
474 445 $element_type = $this->get_type();
475 446
476 447 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() ) ) ) . '"]';
448 + echo '[elementor-element data="' . esc_attr( base64_encode( wp_json_encode( $this->get_raw_data() ) ) ) . '"]';
480 449 return;
481 450 }
482 451
483 452 /**
@@ -543,10 +512,8 @@
543 512 // PHPCS - The content has already been escaped by the `render` method.
544 513 echo $content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
545 514 $this->after_render();
546 515
547 - // TODO: Remove this in the future
548 - // Since version 3.24.0 page scripts/styles are handled by `page_assets`.
549 516 $this->enqueue_scripts();
550 517 $this->enqueue_styles();
551 518 }
552 519
@@ -591,13 +558,15 @@
591 558 if ( $this->is_dynamic_content() ) {
592 559 return true;
593 560 }
594 561
562 + if ( empty( $raw_data['settings']['__dynamic__'] ) ) {
563 + return false;
564 + }
565 +
595 566 $is_dynamic_content = apply_filters( 'elementor/element/is_dynamic_content', false, $raw_data, $this );
596 567
597 - $has_dynamic_tag = $this->has_element_dynamic_tag( $raw_data['settings'] );
598 -
599 - if ( $is_dynamic_content || $has_dynamic_tag ) {
568 + if ( $is_dynamic_content ) {
600 569 return true;
601 570 }
602 571
603 572 return false;
@@ -602,26 +571,8 @@
602 571
603 572 return false;
604 573 }
605 574
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 575 /**
625 576 * Get the element raw data.
626 577 *
627 578 * Retrieve the raw element data, including the id, type, settings, child
@@ -724,9 +675,9 @@
724 675 * @param array|null $controls The available controls.
725 676 *
726 677 * @return array Element data.
727 678 */
728 - public static function on_import_update_dynamic_content( array $config, array $data, $controls = null ): array {
679 + public static function on_import_update_dynamic_content( array $config, array $data, $controls = null ) : array {
729 680 $tags_manager = Plugin::$instance->dynamic_tags;
730 681
731 682 if ( empty( $config['settings'][ $tags_manager::DYNAMIC_SETTING_KEY ] ) ) {
732 683 return $config;
@@ -789,9 +740,8 @@
789 740 'elementor-element-' . $id,
790 741 ],
791 742 'data-id' => $id,
792 743 'data-element_type' => $this->get_type(),
793 - 'data-e-type' => $this->get_type(),
794 744 ] );
795 745
796 746 $class_settings = [];
797 747
@@ -816,15 +766,15 @@
816 766 }
817 767
818 768 $_animation = ! empty( $settings['_animation'] );
819 769 $animation = ! empty( $settings['animation'] );
820 - $has_animation = ( $_animation && 'none' !== $settings['_animation'] ) || ( $animation && 'none' !== $settings['animation'] );
770 + $has_animation = $_animation && 'none' !== $settings['_animation'] || $animation && 'none' !== $settings['animation'];
821 771
822 772 if ( $has_animation ) {
823 773 $is_static_render_mode = Plugin::$instance->frontend->is_static_render_mode();
824 774
825 775 if ( ! $is_static_render_mode ) {
826 - // Hide the element until the animation begins.
776 + // Hide the element until the animation begins
827 777 $this->add_render_attribute( '_wrapper', 'class', 'elementor-invisible' );
828 778 }
829 779 }
830 780
@@ -852,15 +802,13 @@
852 802 * Register the Transform controls in the advanced tab of the element.
853 803 *
854 804 * Previously registered under the Widget_Common class, but registered a more fundamental level now to enable access from other widgets.
855 805 *
856 - * @param string $element_selector
857 - * @param string $transform_selector_class
858 - * @return void
859 806 * @since 3.9.0
860 807 * @access protected
808 + * @return void
861 809 */
862 - protected function register_transform_section( $element_selector = '', $transform_selector_class = ' > .elementor-widget-container' ) {
810 + protected function register_transform_section( $element_selector = '' ) {
863 811 $default_unit_values_deg = [];
864 812 $default_unit_values_ms = [];
865 813
866 814 // Set the default unit sizes for all active breakpoints.
@@ -889,8 +837,9 @@
889 837 $this->start_controls_tabs( '_tabs_positioning' );
890 838
891 839 $transform_prefix_class = 'e-';
892 840 $transform_return_value = 'transform';
841 + $transform_selector_class = ' > .elementor-widget-container';
893 842 $transform_css_modifier = '';
894 843
895 844 if ( 'con' === $element_selector ) {
896 845 $transform_selector_class = '.e-' . $element_selector;
@@ -953,9 +902,8 @@
953 902 ],
954 903 'condition' => [
955 904 "_transform_rotate_popover{$tab}!" => '',
956 905 ],
957 - 'frontend_available' => true,
958 906 ]
959 907 );
960 908
961 909 $this->add_responsive_control(
@@ -1333,9 +1281,9 @@
1333 1281 'relation' => 'or',
1334 1282 'terms' => array_merge( $transform_origin_conditions, $transform_origin_conditions_hover ),
1335 1283 ];
1336 1284
1337 - // Will override motion effect transform-origin.
1285 + // Will override motion effect transform-origin
1338 1286 $this->add_responsive_control(
1339 1287 'motion_fx_transform_x_anchor_point',
1340 1288 [
1341 1289 'label' => esc_html__( 'X Anchor Point', 'elementor' ),
@@ -1361,9 +1309,9 @@
1361 1309 ],
1362 1310 ]
1363 1311 );
1364 1312
1365 - // Will override motion effect transform-origin.
1313 + // Will override motion effect transform-origin
1366 1314 $this->add_responsive_control(
1367 1315 'motion_fx_transform_y_anchor_point',
1368 1316 [
1369 1317 'label' => esc_html__( 'Y Anchor Point', 'elementor' ),
@@ -1514,11 +1462,8 @@
1514 1462
1515 1463 /**
1516 1464 * A Base method for sanitizing the settings before save.
1517 1465 * This method is meant to be overridden by the element.
1518 - *
1519 - * @param array $settings
1520 - * @return array
1521 1466 */
1522 1467 protected function on_save( array $settings ) {
1523 1468 return $settings;
1524 1469 }
@@ -1537,9 +1482,9 @@
1537 1482 */
1538 1483 private function get_child_type( $element_data ) {
1539 1484 $child_type = $this->_get_default_child_type( $element_data );
1540 1485
1541 - // If it's not a valid widget ( like a deactivated plugin ).
1486 + // If it's not a valid widget ( like a deactivated plugin )
1542 1487 if ( ! $child_type ) {
1543 1488 return false;
1544 1489 }
1545 1490
@@ -1584,12 +1529,8 @@
1584 1529 $this->add_child( $child_data );
1585 1530 }
1586 1531 }
1587 1532
1588 - public function has_widget_inner_wrapper(): bool {
1589 - return true;
1590 - }
1591 -
1592 1533 /**
1593 1534 * Element base constructor.
1594 1535 *
1595 1536 * Initializing the element base class using `$data` and `$args`.
@@ -1602,9 +1543,9 @@
1602 1543 *
1603 1544 * @param array $data Optional. Element data. Default is an empty array.
1604 1545 * @param array|null $args Optional. Element default arguments. Default is null.
1605 1546 **/
1606 - public function __construct( array $data = [], ?array $args = null ) {
1547 + public function __construct( array $data = [], array $args = null ) {
1607 1548 if ( $data ) {
1608 1549 $this->is_type_instance = false;
1609 1550 } elseif ( $args ) {
1610 1551 $this->default_args = $args;