PluginProbe
Elementor Website Builder – more than just a page builder / 3.32.0-dev3
Elementor Website Builder – more than just a page builder v3.32.0-dev3
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 +13 -40 4.0.83.32.0-dev3 View file →
@@ -1,21 +1,20 @@
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\PropDependencies\Manager as Dependency_Manager;
4 +use Elementor\Modules\AtomicWidgets\Elements\Atomic_Element_Base;
6 5 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
7 6 use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
8 7 use Elementor\Modules\AtomicWidgets\Styles\Style_Definition;
9 8 use Elementor\Modules\AtomicWidgets\Styles\Style_Variant;
10 9 use Elementor\Modules\AtomicWidgets\Controls\Section;
11 -use Elementor\Modules\AtomicWidgets\Controls\Types\Html_Tag_Control;
12 10 use Elementor\Modules\AtomicWidgets\Controls\Types\Link_Control;
11 +use Elementor\Modules\AtomicWidgets\Controls\Types\Select_Control;
13 12 use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control;
13 +use Elementor\Modules\AtomicWidgets\PropDependencies\Manager as Dependency_Manager;
14 +use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type;
14 15 use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type;
15 -use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type;
16 16 use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type;
17 -use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type;
18 17
19 18 if ( ! defined( 'ABSPATH' ) ) {
20 19 exit; // Exit if accessed directly.
21 20 }
@@ -22,13 +21,8 @@
22 21
23 22 class Flexbox extends Atomic_Element_Base {
24 23 const BASE_STYLE_KEY = 'base';
25 24
26 - public function __construct( $data = [], $args = null ) {
27 - parent::__construct( $data, $args );
28 - $this->meta( 'is_container', true );
29 - }
30 -
31 25 public static function get_type() {
32 26 return 'e-flexbox';
33 27 }
34 28
@@ -48,40 +42,25 @@
48 42 return 'eicon-flexbox';
49 43 }
50 44
51 45 protected static function define_props_schema(): array {
52 - $tag_dependencies = Dependency_Manager::make( Dependency_Manager::RELATION_AND )
46 + $tag_dependencies = Dependency_Manager::make()
53 47 ->where( [
54 - 'operator' => 'ne',
55 - 'path' => [ 'link', 'destination' ],
56 - 'nestedPath' => [ 'group' ],
57 - 'value' => 'action',
58 - 'newValue' => [
59 - '$$type' => 'string',
60 - 'value' => 'button',
61 - ],
62 - ] )->where( [
63 48 'operator' => 'not_exist',
64 49 'path' => [ 'link', 'destination' ],
65 - 'newValue' => [
66 - '$$type' => 'string',
67 - 'value' => 'a',
68 - ],
69 - ] )->get();
50 + ] )
51 + ->get();
70 52
71 53 return [
72 54 'classes' => Classes_Prop_Type::make()
73 55 ->default( [] ),
74 56 'tag' => String_Prop_Type::make()
75 - ->enum( [ 'div', 'header', 'section', 'article', 'aside', 'footer', 'a', 'button' ] )
57 + ->enum( [ 'div', 'header', 'section', 'article', 'aside', 'footer' ] )
76 58 ->default( 'div' )
77 - ->description( 'The HTML tag for the flexbox container. Could be div, header, section, article, aside, footer, or a (link).' )
78 59 ->set_dependencies( $tag_dependencies ),
79 60 'link' => Link_Prop_Type::make(),
80 - 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ),
61 + 'attributes' => Attributes_Prop_Type::make(),
81 62 ];
82 -
83 - return $schema;
84 63 }
85 64
86 65 protected function define_atomic_controls(): array {
87 66 return [
@@ -88,9 +67,9 @@
88 67 Section::make()
89 68 ->set_label( __( 'Settings', 'elementor' ) )
90 69 ->set_id( 'settings' )
91 70 ->set_items( [
92 - Html_Tag_Control::bind_to( 'tag' )
71 + Select_Control::bind_to( 'tag' )
93 72 ->set_options( [
94 73 [
95 74 'value' => 'div',
96 75 'label' => 'Div',
@@ -115,14 +94,10 @@
115 94 'value' => 'footer',
116 95 'label' => 'Footer',
117 96 ],
118 97 ])
119 - ->set_label( esc_html__( 'HTML Tag', 'elementor' ) )
120 - ->set_fallback_labels( [
121 - 'a' => 'a (link)',
122 - ] ),
98 + ->set_label( esc_html__( 'HTML Tag', 'elementor' ) ),
123 99 Link_Control::bind_to( 'link' )
124 - ->set_placeholder( __( 'Type or paste your URL', 'elementor' ) )
125 100 ->set_label( __( 'Link', 'elementor' ) )
126 101 ->set_meta( [
127 102 'topDivider' => true,
128 103 ] ),
@@ -158,9 +133,8 @@
158 133 protected function add_render_attributes() {
159 134 parent::add_render_attributes();
160 135 $settings = $this->get_atomic_settings();
161 136 $base_style_class = $this->get_base_styles_dictionary()[ static::BASE_STYLE_KEY ];
162 - $initial_attributes = $this->define_initial_attributes();
163 137
164 138 $attributes = [
165 139 'class' => [
166 140 'e-con',
@@ -174,11 +148,10 @@
174 148 $attributes['id'] = esc_attr( $settings['_cssid'] );
175 149 }
176 150
177 151 if ( ! empty( $settings['link']['href'] ) ) {
178 - $link_attributes = $this->get_link_attributes( $settings['link'] );
179 - $attributes = array_merge( $attributes, $link_attributes );
152 + $attributes = array_merge( $attributes, $settings['link'] );
180 153 }
181 154
182 - $this->add_render_attribute( '_wrapper', array_merge( $initial_attributes, $attributes ) );
155 + $this->add_render_attribute( '_wrapper', $attributes );
183 156 }
184 157 }