PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
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 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
← All changes | modules/atomic-widgets/elements/base/atomic-element-base.php +48 -11 4.1.0-dev24.3.0-beta3 View file →
@@ -2,8 +2,9 @@
2 2
3 3 namespace Elementor\Modules\AtomicWidgets\Elements\Base;
4 4
5 5 use Elementor\Element_Base;
6 +use Elementor\Modules\AtomicWidgets\ChildrenDependencies\Child_Dependency;
6 7 use Elementor\Modules\AtomicWidgets\PropDependencies\Manager as Dependency_Manager;
7 8 use Elementor\Modules\AtomicWidgets\PropTypes\Contracts\Prop_Type;
8 9 use Elementor\Modules\AtomicWidgets\PropTypes\Concerns\Has_Meta;
9 10 use Elementor\Plugin;
@@ -16,8 +17,20 @@
16 17 abstract class Atomic_Element_Base extends Element_Base {
17 18 use Has_Atomic_Base;
18 19 use Has_Meta;
19 20
21 + /**
22 + * Maps atomic element type → the minor version when the "New" badge expires.
23 + * Format: 'element-type' => 'major.minor' (patch is ignored during comparison).
24 + *
25 + * @var array<string, string>
26 + */
27 + private const NEW_ATOMIC_ELEMENTS = [
28 + 'e-background-video' => '4.3',
29 + 'e-accordion' => '4.3',
30 + 'e-list' => '4.3',
31 + ];
32 +
20 33 protected $version = '0.0';
21 34 protected $styles = [];
22 35 protected $interactions = [];
23 36 protected $editor_settings = [];
@@ -84,8 +97,9 @@
84 97 $config['atomic_style_states'] = $this->define_atomic_style_states();
85 98 $config['atomic_pseudo_states'] = $this->define_atomic_pseudo_states();
86 99 $config['dependencies_per_target_mapping'] = Dependency_Manager::get_source_to_dependents( $props_schema );
87 100 $config['base_styles'] = $this->get_base_styles();
101 + $config['base_settings'] = $this->get_base_settings();
88 102 $config['version'] = $this->version;
89 103 $config['show_in_panel'] = $this->should_show_in_panel();
90 104 $config['categories'] = $this->define_panel_categories();
91 105 $config['hide_on_search'] = false;
@@ -91,13 +105,16 @@
91 105 $config['hide_on_search'] = false;
92 106 $config['controls'] = [];
93 107 $config['keywords'] = $this->get_keywords();
94 108 $config['default_children'] = $this->define_default_children();
109 + $config['children_dependencies'] = $this->get_children_dependencies_config();
95 110 $config['initial_attributes'] = $this->define_initial_attributes();
96 111 $config['include_in_widgets_config'] = true;
97 - $config['default_html_tag'] = $this->define_default_html_tag();
112 + $config['default_html_tag'] = static::get_computed_html_tag( [] );
113 + $config['html_tag_follows_link'] = static::html_tag_follows_link();
98 114 $config['meta'] = $this->get_meta();
99 115 $config['allowed_child_types'] = $this->define_allowed_child_types();
116 + $config['new_until_version'] = self::NEW_ATOMIC_ELEMENTS[ $this->get_name() ] ?? '';
100 117
101 118 return $config;
102 119 }
103 120
@@ -112,12 +129,39 @@
112 129 protected function define_default_children() {
113 130 return [];
114 131 }
115 132
116 - protected function define_default_html_tag() {
117 - return 'div';
133 + /**
134 + * Declare settings→children reconcile rules for this element.
135 + *
136 + * Each rule ties a `Dependency_Manager` condition on this element's
137 + * settings to the presence of a specific child element type. The generic
138 + * client-side reconciler (`@elementor/editor-elements/children-dependencies`)
139 + * attaches / detaches the child at the model layer as the condition flips,
140 + * without per-widget v1 hooks.
141 + *
142 + * @return Child_Dependency[]
143 + */
144 + protected function define_children_dependencies(): array {
145 + return [];
118 146 }
119 147
148 + private function get_children_dependencies_config(): array {
149 + $config = [];
150 +
151 + foreach ( $this->define_children_dependencies() as $dependency ) {
152 + if ( ! $dependency instanceof Child_Dependency ) {
153 + throw new \InvalidArgumentException(
154 + esc_html( static::class . '::define_children_dependencies() must return Child_Dependency instances.' )
155 + );
156 + }
157 +
158 + $config[] = $dependency->build();
159 + }
160 +
161 + return $config;
162 + }
163 +
120 164 protected function define_initial_attributes() {
121 165 return [];
122 166 }
123 167
@@ -159,16 +203,9 @@
159 203 *
160 204 * @return string
161 205 */
162 206 protected function get_html_tag(): string {
163 - $settings = $this->get_atomic_settings();
164 - $default_html_tag = $this->define_default_html_tag();
165 -
166 - if ( ! empty( $settings['link']['tag'] ) ) {
167 - return $settings['link']['tag'];
168 - }
169 -
170 - return $settings['tag'] ?? $default_html_tag;
207 + return static::get_computed_html_tag( $this->get_atomic_settings() );
171 208 }
172 209
173 210 /**
174 211 * Print safe HTML tag for the element based on the element settings.