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