PluginProbe
Elementor Website Builder – more than just a page builder / 3.31.2
Elementor Website Builder – more than just a page builder v3.31.2
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/flexbox/flexbox.php +3 -163 4.3.0-beta13.31.2 View file →
@@ -1,44 +1,21 @@
1 1 <?php
2 2 namespace Elementor\Modules\AtomicWidgets\Elements\Flexbox;
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;
7 -use Elementor\Modules\AtomicWidgets\PropDependencies\Manager as Dependency_Manager;
4 +use Elementor\Modules\AtomicWidgets\Elements\Div_Block\Div_Block;
8 5 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
9 -use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
10 6 use Elementor\Modules\AtomicWidgets\Styles\Style_Definition;
11 7 use Elementor\Modules\AtomicWidgets\Styles\Style_Variant;
12 -use Elementor\Modules\AtomicWidgets\Controls\Section;
13 -use Elementor\Modules\AtomicWidgets\Controls\Types\Html_Tag_Control;
14 -use Elementor\Modules\AtomicWidgets\Controls\Types\Link_Control;
15 -use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control;
16 -use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type;
17 -use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type;
18 -use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type;
19 -use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type;
20 8
21 9 if ( ! defined( 'ABSPATH' ) ) {
22 10 exit; // Exit if accessed directly.
23 11 }
24 12
25 -class Flexbox extends Atomic_Element_Base {
26 - use Has_Element_Template;
27 -
28 - const BASE_STYLE_KEY = 'base';
29 -
30 - public function __construct( $data = [], $args = null ) {
31 - parent::__construct( $data, $args );
32 - $this->meta( 'is_container', true );
33 - }
34 -
13 +class Flexbox extends Div_Block {
35 14 public static function get_type() {
36 15 return 'e-flexbox';
37 16 }
38 17
39 - public static $widget_description = 'A container (div) with flex display and flex-direction row by default.';
40 -
41 18 public static function get_element_type(): string {
42 19 return 'e-flexbox';
43 20 }
44 21
@@ -46,9 +23,9 @@
46 23 return esc_html__( 'Flexbox', 'elementor' );
47 24 }
48 25
49 26 public function get_keywords() {
50 - return [ 'ato', 'atom', 'atoms', 'atomic', 'layout' ];
27 + return [ 'ato', 'atom', 'atoms', 'atomic' ];
51 28 }
52 29
53 30 public function get_icon() {
54 31 return 'eicon-flexbox';
@@ -53,105 +30,8 @@
53 30 public function get_icon() {
54 31 return 'eicon-flexbox';
55 32 }
56 33
57 - public static function get_computed_html_tag( array $settings ): string {
58 - return Html_Tag_Computer::compute( $settings, 'div' );
59 - }
60 -
61 - protected static function define_props_schema(): array {
62 - $tag_dependencies = Dependency_Manager::make( Dependency_Manager::RELATION_AND )
63 - ->where( [
64 - 'operator' => 'ne',
65 - 'path' => [ 'link', 'destination' ],
66 - 'nestedPath' => [ 'group' ],
67 - 'value' => 'action',
68 - 'newValue' => [
69 - '$$type' => 'string',
70 - 'value' => 'button',
71 - ],
72 - ] )->where( [
73 - 'operator' => 'not_exist',
74 - 'path' => [ 'link', 'destination' ],
75 - 'newValue' => [
76 - '$$type' => 'string',
77 - 'value' => 'a',
78 - ],
79 - ] )->get();
80 -
81 - return [
82 - 'classes' => Classes_Prop_Type::make()
83 - ->default( [] ),
84 - 'tag' => String_Prop_Type::make()
85 - ->enum( [ 'div', 'header', 'section', 'article', 'aside', 'footer', 'a', 'button', 'main', 'nav' ] )
86 - ->default( 'div' )
87 - ->description( 'The HTML tag for the flexbox container. One of: div, header, section, article, aside, footer, main, nav, a (link), or button.' )
88 - ->set_dependencies( $tag_dependencies ),
89 - 'link' => Link_Prop_Type::make(),
90 - 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ),
91 - ];
92 -
93 - return $schema;
94 - }
95 -
96 - protected function define_atomic_controls(): array {
97 - return [
98 - Section::make()
99 - ->set_label( __( 'Settings', 'elementor' ) )
100 - ->set_id( 'settings' )
101 - ->set_items( [
102 - Html_Tag_Control::bind_to( 'tag' )
103 - ->set_options( [
104 - [
105 - 'value' => 'div',
106 - 'label' => 'Div',
107 - ],
108 - [
109 - 'value' => 'header',
110 - 'label' => 'Header',
111 - ],
112 - [
113 - 'value' => 'section',
114 - 'label' => 'Section',
115 - ],
116 - [
117 - 'value' => 'article',
118 - 'label' => 'Article',
119 - ],
120 - [
121 - 'value' => 'aside',
122 - 'label' => 'Aside',
123 - ],
124 - [
125 - 'value' => 'footer',
126 - 'label' => 'Footer',
127 - ],
128 - [
129 - 'value' => 'main',
130 - 'label' => 'Main',
131 - ],
132 - [
133 - 'value' => 'nav',
134 - 'label' => 'Nav',
135 - ],
136 - ])
137 - ->set_label( esc_html__( 'HTML Tag', 'elementor' ) )
138 - ->set_fallback_labels( [
139 - 'a' => 'a (link)',
140 - ] ),
141 - Link_Control::bind_to( 'link' )
142 - ->set_placeholder( __( 'Type or paste your URL', 'elementor' ) )
143 - ->set_label( __( 'Link', 'elementor' ) )
144 - ->set_meta( [
145 - 'topDivider' => true,
146 - ] ),
147 - Text_Control::bind_to( '_cssid' )
148 - ->set_label( __( 'ID', 'elementor' ) )
149 - ->set_meta( $this->get_css_id_control_meta() ),
150 - ] ),
151 - ];
152 - }
153 -
154 34 protected function define_base_styles(): array {
155 35 $display = String_Prop_Type::generate( 'flex' );
156 36 $flex_direction = String_Prop_Type::generate( 'row' );
157 37
@@ -162,47 +42,7 @@
162 42 ->add_prop( 'display', $display )
163 43 ->add_prop( 'flex-direction', $flex_direction )
164 44 ->add_prop( 'padding', $this->get_base_padding() )
165 45 ),
166 - ];
167 - }
168 -
169 - protected function get_base_padding(): array {
170 - return Size_Prop_Type::generate( [
171 - 'size' => 10,
172 - 'unit' => 'px',
173 - ] );
174 - }
175 -
176 - protected function add_render_attributes() {
177 - parent::add_render_attributes();
178 - $settings = $this->get_atomic_settings();
179 - $base_style_class = $this->get_base_styles_dictionary()[ static::BASE_STYLE_KEY ];
180 - $initial_attributes = $this->define_initial_attributes();
181 -
182 - $attributes = [
183 - 'class' => [
184 - 'e-con',
185 - 'e-atomic-element',
186 - $base_style_class,
187 - ...( $settings['classes'] ?? [] ),
188 - ],
189 - ];
190 -
191 - if ( ! empty( $settings['_cssid'] ) ) {
192 - $attributes['id'] = esc_attr( $settings['_cssid'] );
193 - }
194 -
195 - if ( ! empty( $settings['link']['href'] ) ) {
196 - $link_attributes = $this->get_link_attributes( $settings['link'] );
197 - $attributes = array_merge( $attributes, $link_attributes );
198 - }
199 -
200 - $this->add_render_attribute( '_wrapper', array_merge( $initial_attributes, $attributes ) );
201 - }
202 -
203 - protected function get_templates(): array {
204 - return [
205 - 'elementor/elements/flexbox' => __DIR__ . '/flexbox.html.twig',
206 46 ];
207 47 }
208 48 }