PluginProbe
Elementor Website Builder – more than just a page builder / 3.32.3
Elementor Website Builder – more than just a page builder v3.32.3
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 4.1.0-beta2 4.1.0-dev2 4.0.8 All 454 releases
← All changes | modules/atomic-widgets/elements/div-block/div-block.php +12 -59 4.3.0-beta2 → 3.32.3 View file →
@@ -1,10 +1,8 @@
1 1 <?php
2 2 namespace Elementor\Modules\AtomicWidgets\Elements\Div_Block;
3 3
4 -use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Element_Base;
5 -use Elementor\Modules\AtomicWidgets\Elements\Base\Has_Element_Template;
6 -use Elementor\Modules\AtomicWidgets\Elements\Base\Html_Tag_Computer;
4 +use Elementor\Modules\AtomicWidgets\Elements\Atomic_Element_Base;
7 5 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
8 6 use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
9 7 use Elementor\Modules\AtomicWidgets\Styles\Style_Definition;
10 8 use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type;
@@ -10,14 +8,13 @@
10 8 use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type;
11 9 use Elementor\Modules\AtomicWidgets\Styles\Style_Variant;
12 10 use Elementor\Modules\AtomicWidgets\Controls\Section;
13 11 use Elementor\Modules\AtomicWidgets\Controls\Types\Link_Control;
14 -use Elementor\Modules\AtomicWidgets\Controls\Types\Html_Tag_Control;
12 +use Elementor\Modules\AtomicWidgets\Controls\Types\Select_Control;
15 13 use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control;
16 14 use Elementor\Modules\AtomicWidgets\PropDependencies\Manager as Dependency_Manager;
17 15 use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type;
18 16 use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type;
19 -use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type;
20 17
21 18 if ( ! defined( 'ABSPATH' ) ) {
22 19 exit; // Exit if accessed directly.
23 20 }
@@ -22,17 +19,10 @@
22 19 exit; // Exit if accessed directly.
23 20 }
24 21
25 22 class Div_Block extends Atomic_Element_Base {
26 - use Has_Element_Template;
27 -
28 23 const BASE_STYLE_KEY = 'base';
29 24
30 - public function __construct( $data = [], $args = null ) {
31 - parent::__construct( $data, $args );
32 - $this->meta( 'is_container', true );
33 - }
34 -
35 25 public static function get_type() {
36 26 return 'e-div-block';
37 27 }
38 28
@@ -40,13 +30,13 @@
40 30 return 'e-div-block';
41 31 }
42 32
43 33 public function get_title() {
44 - return esc_html__( 'Div block', 'elementor' );
34 + return esc_html__( 'Div Block', 'elementor' );
45 35 }
46 36
47 37 public function get_keywords() {
48 - return [ 'ato', 'atom', 'atoms', 'atomic', 'layout' ];
38 + return [ 'ato', 'atom', 'atoms', 'atomic' ];
49 39 }
50 40
51 41 public function get_icon() {
52 42 return 'eicon-div-block';
@@ -51,42 +41,25 @@
51 41 public function get_icon() {
52 42 return 'eicon-div-block';
53 43 }
54 44
55 - public static function get_computed_html_tag( array $settings ): string {
56 - return Html_Tag_Computer::compute( $settings, 'div' );
57 - }
58 -
59 45 protected static function define_props_schema(): array {
60 - $tag_dependencies = Dependency_Manager::make( Dependency_Manager::RELATION_AND )
46 + $tag_dependencies = Dependency_Manager::make()
61 47 ->where( [
62 - 'operator' => 'ne',
63 - 'path' => [ 'link', 'destination' ],
64 - 'nestedPath' => [ 'group' ],
65 - 'value' => 'action',
66 - 'newValue' => [
67 - '$$type' => 'string',
68 - 'value' => 'button',
69 - ],
70 - ] )->where( [
71 48 'operator' => 'not_exist',
72 49 'path' => [ 'link', 'destination' ],
73 - 'newValue' => [
74 - '$$type' => 'string',
75 - 'value' => 'a',
76 - ],
77 - ] )->get();
50 + ] )
51 + ->get();
78 52
79 53 return [
80 54 'classes' => Classes_Prop_Type::make()
81 55 ->default( [] ),
82 56 'tag' => String_Prop_Type::make()
83 - ->enum( [ 'div', 'header', 'section', 'article', 'aside', 'footer', 'a', 'button', 'main', 'nav' ] )
57 + ->enum( [ 'div', 'header', 'section', 'article', 'aside', 'footer' ] )
84 58 ->default( 'div' )
85 - ->description( 'The HTML tag for the div block container. One of: div, header, section, article, aside, footer, main, nav, a (link), or button. Do not use heading or paragraph tags.' )
86 59 ->set_dependencies( $tag_dependencies ),
87 60 'link' => Link_Prop_Type::make(),
88 - 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ),
61 + 'attributes' => Attributes_Prop_Type::make(),
89 62 ];
90 63 }
91 64
92 65 protected function define_atomic_controls(): array {
@@ -94,9 +67,9 @@
94 67 Section::make()
95 68 ->set_label( __( 'Settings', 'elementor' ) )
96 69 ->set_id( 'settings' )
97 70 ->set_items( [
98 - Html_Tag_Control::bind_to( 'tag' )
71 + Select_Control::bind_to( 'tag' )
99 72 ->set_options( [
100 73 [
101 74 'value' => 'div',
102 75 'label' => 'Div',
@@ -120,23 +93,11 @@
120 93 [
121 94 'value' => 'footer',
122 95 'label' => 'Footer',
123 96 ],
124 - [
125 - 'value' => 'main',
126 - 'label' => 'Main',
127 - ],
128 - [
129 - 'value' => 'nav',
130 - 'label' => 'Nav',
131 - ],
132 97 ])
133 - ->set_fallback_labels( [
134 - 'a' => 'a (link)',
135 - ] )
136 98 ->set_label( esc_html__( 'HTML Tag', 'elementor' ) ),
137 99 Link_Control::bind_to( 'link' )
138 - ->set_placeholder( __( 'Type or paste your URL', 'elementor' ) )
139 100 ->set_label( __( 'Link', 'elementor' ) )
140 101 ->set_meta( [
141 102 'topDivider' => true,
142 103 ] ),
@@ -178,9 +139,8 @@
178 139 protected function add_render_attributes() {
179 140 parent::add_render_attributes();
180 141 $settings = $this->get_atomic_settings();
181 142 $base_style_class = $this->get_base_styles_dictionary()[ static::BASE_STYLE_KEY ];
182 - $initial_attributes = $this->define_initial_attributes();
183 143
184 144 $attributes = [
185 145 'class' => [
186 146 'e-con',
@@ -194,17 +154,10 @@
194 154 $attributes['id'] = esc_attr( $settings['_cssid'] );
195 155 }
196 156
197 157 if ( ! empty( $settings['link']['href'] ) ) {
198 - $link_attributes = $this->get_link_attributes( $settings['link'] );
199 - $attributes = array_merge( $attributes, $link_attributes );
158 + $attributes = array_merge( $attributes, $settings['link'] );
200 159 }
201 160
202 - $this->add_render_attribute( '_wrapper', array_merge( $initial_attributes, $attributes ) );
203 - }
204 -
205 - protected function get_templates(): array {
206 - return [
207 - 'elementor/elements/div-block' => __DIR__ . '/div-block.html.twig',
208 - ];
161 + $this->add_render_attribute( '_wrapper', $attributes );
209 162 }
210 163 }