| @@ -5,9 +5,8 @@ | ||
| 5 | 5 | use Elementor\Core\Base\Elements_Iteration_Actions\Base as Elements_Iteration_Action; |
| 6 | 6 | use Elementor\Core\Behaviors\Interfaces\Lock_Behavior; |
| 7 | 7 | use Elementor\Core\Files\CSS\Post as Post_CSS; |
| 8 | 8 | use Elementor\Core\Settings\Page\Model as Page_Model; |
| 9 | -use Elementor\Core\Utils\Collection; | |
| 10 | 9 | use Elementor\Core\Utils\Exceptions; |
| 11 | 10 | use Elementor\Includes\Elements\Container; |
| 12 | 11 | use Elementor\Plugin; |
| 13 | 12 | use Elementor\Controls_Manager; |
| @@ -19,8 +18,9 @@ | ||
| 19 | 18 | use Elementor\Widget_Base; |
| 20 | 19 | use Elementor\Core\Settings\Page\Manager as PageManager; |
| 21 | 20 | use ElementorPro\Modules\Library\Widgets\Template; |
| 22 | 21 | use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager; |
| 22 | +use Elementor\Modules\AtomicWidgets\Module as Atomic_Widgets_Module; | |
| 23 | 23 | |
| 24 | 24 | if ( ! defined( 'ABSPATH' ) ) { |
| 25 | 25 | exit; // Exit if accessed directly. |
| 26 | 26 | } |
| @@ -608,12 +608,8 @@ | ||
| 608 | 608 | |
| 609 | 609 | if ( $autosave_id ) { |
| 610 | 610 | $document = Plugin::$instance->documents->get( $autosave_id ); |
| 611 | 611 | } elseif ( $create ) { |
| 612 | - if ( ! function_exists( 'wp_create_post_autosave' ) ) { | |
| 613 | - require_once ABSPATH . 'wp-admin/includes/post.php'; | |
| 614 | - } | |
| 615 | - | |
| 616 | 612 | $autosave_id = wp_create_post_autosave( [ |
| 617 | 613 | 'post_ID' => $this->post->ID, |
| 618 | 614 | 'post_type' => $this->post->post_type, |
| 619 | 615 | 'post_title' => $this->post->post_title, |
| @@ -642,9 +638,9 @@ | ||
| 642 | 638 | * Fired by `post_row_actions` and `page_row_actions` filters. |
| 643 | 639 | * |
| 644 | 640 | * @access public |
| 645 | 641 | * |
| 646 | - * @param array $actions An array of row action links. | |
| 642 | + * @param array $actions An array of row action links. | |
| 647 | 643 | * |
| 648 | 644 | * @return array An updated array of row action links. |
| 649 | 645 | */ |
| 650 | 646 | public function filter_admin_row_actions( $actions ) { |
| @@ -729,16 +725,26 @@ | ||
| 729 | 725 | |
| 730 | 726 | do_action( 'elementor/document/before_get_config', $this ); |
| 731 | 727 | |
| 732 | 728 | if ( static::get_property( 'has_elements' ) ) { |
| 733 | - $elements_config = Collection::make( Plugin::$instance->elements_manager->get_element_types() ) | |
| 734 | - ->filter( fn( $element ) => ( ! empty( $element->get_config()['include_in_widgets_config'] ) ) ) | |
| 735 | - ->map( fn( $element ) => $element->get_config() ) | |
| 736 | - ->all(); | |
| 729 | + $container_config = []; | |
| 737 | 730 | |
| 731 | + if ( Plugin::$instance->experiments->is_feature_active( 'container' ) ) { | |
| 732 | + $container_config['container'] = | |
| 733 | + Plugin::$instance->elements_manager->get_element_types( 'container' )->get_config(); | |
| 734 | + } | |
| 735 | + | |
| 736 | + if ( Plugin::$instance->experiments->is_feature_active( Atomic_Widgets_Module::EXPERIMENT_NAME ) ) { | |
| 737 | + // Order reflects the order in the editor. | |
| 738 | + $atomic_elements = [ 'e-flexbox', 'e-div-block' ]; | |
| 739 | + | |
| 740 | + foreach ( $atomic_elements as $element ) { | |
| 741 | + $container_config[ $element ] = Plugin::$instance->elements_manager->get_element_types( $element )->get_config(); | |
| 742 | + } | |
| 743 | + } | |
| 744 | + | |
| 738 | 745 | $config['elements'] = $this->get_elements_raw_data( null, true ); |
| 739 | - // `get_elements_raw_data` has to be called before `get_widget_types_config`, because it affects it. | |
| 740 | - $config['widgets'] = array_merge( $elements_config, Plugin::$instance->widgets_manager->get_widget_types_config() ); | |
| 746 | + $config['widgets'] = $container_config + Plugin::$instance->widgets_manager->get_widget_types_config(); | |
| 741 | 747 | } |
| 742 | 748 | |
| 743 | 749 | $additional_config = []; |
| 744 | 750 | |
| @@ -1052,10 +1058,8 @@ | ||
| 1052 | 1058 | * @param null $data |
| 1053 | 1059 | * @param bool $with_html_content |
| 1054 | 1060 | * |
| 1055 | 1061 | * @return array |
| 1056 | - * | |
| 1057 | - * @throws \Exception If elements retrieval fails or data processing errors occur. | |
| 1058 | 1062 | */ |
| 1059 | 1063 | public function get_elements_raw_data( $data = null, $with_html_content = false ) { |
| 1060 | 1064 | if ( ! static::get_property( 'has_elements' ) ) { |
| 1061 | 1065 | return []; |
| @@ -1064,23 +1068,8 @@ | ||
| 1064 | 1068 | if ( is_null( $data ) ) { |
| 1065 | 1069 | $data = $this->get_elements_data(); |
| 1066 | 1070 | } |
| 1067 | 1071 | |
| 1068 | - /** | |
| 1069 | - * Filters document elements data after loading. | |
| 1070 | - * | |
| 1071 | - * Allows modification of elements data when loading (not saving). | |
| 1072 | - * Useful for migrations, transformations, or data enrichment. | |
| 1073 | - * | |
| 1074 | - * @since 3.35.0 | |
| 1075 | - * | |
| 1076 | - * @param array $data The elements data array. | |
| 1077 | - * @param \Elementor\Core\Base\Document $document The document instance. | |
| 1078 | - */ | |
| 1079 | - if ( ! $this->is_saving ) { | |
| 1080 | - $data = apply_filters( 'elementor/document/load/data', $data, $this ); | |
| 1081 | - } | |
| 1082 | - | |
| 1083 | 1072 | // Change the current documents, so widgets can use `documents->get_current` and other post data |
| 1084 | 1073 | Plugin::$instance->documents->switch_to_document( $this ); |
| 1085 | 1074 | |
| 1086 | 1075 | $editor_data = []; |
| @@ -1476,9 +1465,9 @@ | ||
| 1476 | 1465 | * @since 2.0.4 |
| 1477 | 1466 | * @access public |
| 1478 | 1467 | * |
| 1479 | 1468 | * @param string $key Meta data key. |
| 1480 | - * @param mixed $value Meta data value. | |
| 1469 | + * @param mixed $value Meta data value. | |
| 1481 | 1470 | * |
| 1482 | 1471 | * @return bool|int |
| 1483 | 1472 | */ |
| 1484 | 1473 | public function update_main_meta( $key, $value ) { |
| @@ -1813,12 +1802,12 @@ | ||
| 1813 | 1802 | } |
| 1814 | 1803 | |
| 1815 | 1804 | /** |
| 1816 | 1805 | * @since 2.1.3 |
| 1817 | - * @access public | |
| 1806 | + * @access protected | |
| 1818 | 1807 | */ |
| 1819 | - public function print_elements( $elements_data ) { | |
| 1820 | - $is_element_cache_active = 'disable' !== get_option( 'elementor_element_cache_ttl', '' ); | |
| 1808 | + protected function print_elements( $elements_data ) { | |
| 1809 | + $is_element_cache_active = Plugin::$instance->experiments->is_feature_active( 'e_element_cache' ) && 'disable' !== get_option( 'elementor_element_cache_ttl', '' ); | |
| 1821 | 1810 | if ( ! $is_element_cache_active ) { |
| 1822 | 1811 | ob_start(); |
| 1823 | 1812 | |
| 1824 | 1813 | $this->do_print_elements( $elements_data ); |
| @@ -2107,10 +2096,6 @@ | ||
| 2107 | 2096 | $this->elements_iteration_actions[] = new Assets_Iteration_Action( $this ); |
| 2108 | 2097 | } |
| 2109 | 2098 | |
| 2110 | 2099 | return $this->elements_iteration_actions; |
| 2111 | - } | |
| 2112 | - | |
| 2113 | - public function get_elementor_version() { | |
| 2114 | - return $this->get_main_meta( '_elementor_version' ); | |
| 2115 | 2100 | } |
| 2116 | 2101 | } |