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 +47 -11 4.2.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 = [];
@@ -92,13 +105,16 @@
92 105 $config['hide_on_search'] = false;
93 106 $config['controls'] = [];
94 107 $config['keywords'] = $this->get_keywords();
95 108 $config['default_children'] = $this->define_default_children();
109 + $config['children_dependencies'] = $this->get_children_dependencies_config();
96 110 $config['initial_attributes'] = $this->define_initial_attributes();
97 111 $config['include_in_widgets_config'] = true;
98 - $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();
99 114 $config['meta'] = $this->get_meta();
100 115 $config['allowed_child_types'] = $this->define_allowed_child_types();
116 + $config['new_until_version'] = self::NEW_ATOMIC_ELEMENTS[ $this->get_name() ] ?? '';
101 117
102 118 return $config;
103 119 }
104 120
@@ -113,12 +129,39 @@
113 129 protected function define_default_children() {
114 130 return [];
115 131 }
116 132
117 - protected function define_default_html_tag() {
118 - 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 [];
119 146 }
120 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 +
121 164 protected function define_initial_attributes() {
122 165 return [];
123 166 }
124 167
@@ -160,16 +203,9 @@
160 203 *
161 204 * @return string
162 205 */
163 206 protected function get_html_tag(): string {
164 - $settings = $this->get_atomic_settings();
165 - $default_html_tag = $this->define_default_html_tag();
166 -
167 - if ( ! empty( $settings['link']['tag'] ) ) {
168 - return $settings['link']['tag'];
169 - }
170 -
171 - return $settings['tag'] ?? $default_html_tag;
207 + return static::get_computed_html_tag( $this->get_atomic_settings() );
172 208 }
173 209
174 210 /**
175 211 * Print safe HTML tag for the element based on the element settings.