PluginProbe
Elementor Website Builder – more than just a page builder / 3.30.1
Elementor Website Builder – more than just a page builder v3.30.1
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 | core/base/document.php +24 -56 4.2.0-dev23.30.1 View file →
@@ -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 }
@@ -46,10 +46,8 @@
46 46 const BUILT_WITH_ELEMENTOR_META_KEY = '_elementor_edit_mode';
47 47
48 48 const CACHE_META_KEY = '_elementor_element_cache';
49 49
50 - const UNEDITABLE_WITH_ELEMENTOR_TYPES = [ 'kit' ];
51 -
52 50 /**
53 51 * Document publish status.
54 52 */
55 53 const STATUS_PUBLISH = 'publish';
@@ -232,16 +230,9 @@
232 230 *
233 231 * @return array
234 232 */
235 233 private static function get_panel_category_item( $promotion, $index, array $categories, bool $has_pro ): array {
236 - $keep_promotion = $has_pro && apply_filters(
237 - 'elementor/document/panel_category_keep_promotion',
238 - false,
239 - $index,
240 - $promotion
241 - );
242 -
243 - if ( ! $has_pro || $keep_promotion ) {
234 + if ( ! $has_pro ) {
244 235 $categories[ $index ]['promotion'] = Filtered_Promotions_Manager::get_filtered_promotion_data(
245 236 $promotion,
246 237 'elementor/panel/' . $index . '/custom_promotion',
247 238 'url'
@@ -617,12 +608,8 @@
617 608
618 609 if ( $autosave_id ) {
619 610 $document = Plugin::$instance->documents->get( $autosave_id );
620 611 } elseif ( $create ) {
621 - if ( ! function_exists( 'wp_create_post_autosave' ) ) {
622 - require_once ABSPATH . 'wp-admin/includes/post.php';
623 - }
624 -
625 612 $autosave_id = wp_create_post_autosave( [
626 613 'post_ID' => $this->post->ID,
627 614 'post_type' => $this->post->post_type,
628 615 'post_title' => $this->post->post_title,
@@ -651,14 +638,14 @@
651 638 * Fired by `post_row_actions` and `page_row_actions` filters.
652 639 *
653 640 * @access public
654 641 *
655 - * @param array $actions An array of row action links.
642 + * @param array $actions An array of row action links.
656 643 *
657 644 * @return array An updated array of row action links.
658 645 */
659 646 public function filter_admin_row_actions( $actions ) {
660 - if ( $this->is_editable_with_elementor() ) {
647 + if ( $this->is_built_with_elementor() && $this->is_editable_by_current_user() ) {
661 648 $actions['edit_with_elementor'] = sprintf(
662 649 '<a href="%1$s">%2$s</a>',
663 650 $this->get_edit_url(),
664 651 __( 'Edit with Elementor', 'elementor' )
@@ -667,16 +654,8 @@
667 654
668 655 return $actions;
669 656 }
670 657
671 - public function is_editable_with_elementor() {
672 - if ( in_array( $this->get_type(), self::UNEDITABLE_WITH_ELEMENTOR_TYPES ) ) {
673 - return false;
674 - }
675 -
676 - return $this->is_editable_by_current_user() && $this->is_built_with_elementor();
677 - }
678 -
679 658 /**
680 659 * @since 2.0.0
681 660 * @access public
682 661 */
@@ -746,16 +725,26 @@
746 725
747 726 do_action( 'elementor/document/before_get_config', $this );
748 727
749 728 if ( static::get_property( 'has_elements' ) ) {
750 - $elements_config = Collection::make( Plugin::$instance->elements_manager->get_element_types() )
751 - ->filter( fn( $element ) => ( ! empty( $element->get_config()['include_in_widgets_config'] ) ) )
752 - ->map( fn( $element ) => $element->get_config() )
753 - ->all();
729 + $container_config = [];
754 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 +
755 745 $config['elements'] = $this->get_elements_raw_data( null, true );
756 - // `get_elements_raw_data` has to be called before `get_widget_types_config`, because it affects it.
757 - $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();
758 747 }
759 748
760 749 $additional_config = [];
761 750
@@ -1069,10 +1058,8 @@
1069 1058 * @param null $data
1070 1059 * @param bool $with_html_content
1071 1060 *
1072 1061 * @return array
1073 - *
1074 - * @throws \Exception If elements retrieval fails or data processing errors occur.
1075 1062 */
1076 1063 public function get_elements_raw_data( $data = null, $with_html_content = false ) {
1077 1064 if ( ! static::get_property( 'has_elements' ) ) {
1078 1065 return [];
@@ -1081,23 +1068,8 @@
1081 1068 if ( is_null( $data ) ) {
1082 1069 $data = $this->get_elements_data();
1083 1070 }
1084 1071
1085 - /**
1086 - * Filters document elements data after loading.
1087 - *
1088 - * Allows modification of elements data when loading (not saving).
1089 - * Useful for migrations, transformations, or data enrichment.
1090 - *
1091 - * @since 3.35.0
1092 - *
1093 - * @param array $data The elements data array.
1094 - * @param \Elementor\Core\Base\Document $document The document instance.
1095 - */
1096 - if ( ! $this->is_saving ) {
1097 - $data = apply_filters( 'elementor/document/load/data', $data, $this );
1098 - }
1099 -
1100 1072 // Change the current documents, so widgets can use `documents->get_current` and other post data
1101 1073 Plugin::$instance->documents->switch_to_document( $this );
1102 1074
1103 1075 $editor_data = [];
@@ -1493,9 +1465,9 @@
1493 1465 * @since 2.0.4
1494 1466 * @access public
1495 1467 *
1496 1468 * @param string $key Meta data key.
1497 - * @param mixed $value Meta data value.
1469 + * @param mixed $value Meta data value.
1498 1470 *
1499 1471 * @return bool|int
1500 1472 */
1501 1473 public function update_main_meta( $key, $value ) {
@@ -1830,12 +1802,12 @@
1830 1802 }
1831 1803
1832 1804 /**
1833 1805 * @since 2.1.3
1834 - * @access public
1806 + * @access protected
1835 1807 */
1836 - public function print_elements( $elements_data ) {
1837 - $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', '' );
1838 1810 if ( ! $is_element_cache_active ) {
1839 1811 ob_start();
1840 1812
1841 1813 $this->do_print_elements( $elements_data );
@@ -2124,10 +2096,6 @@
2124 2096 $this->elements_iteration_actions[] = new Assets_Iteration_Action( $this );
2125 2097 }
2126 2098
2127 2099 return $this->elements_iteration_actions;
2128 - }
2129 -
2130 - public function get_elementor_version() {
2131 - return $this->get_main_meta( '_elementor_version' );
2132 2100 }
2133 2101 }