← All changes
|
modules/atomic-widgets/elements/flexbox/flexbox.php
+12
-38
4.2.3
→
3.34.1
View file →
| @@ -1,10 +1,8 @@ | ||
| 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\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\Styles\Style_Variant; |
| @@ -11,12 +9,12 @@ | ||
| 11 | 9 | use Elementor\Modules\AtomicWidgets\Controls\Section; |
| 12 | 10 | use Elementor\Modules\AtomicWidgets\Controls\Types\Html_Tag_Control; |
| 13 | 11 | use Elementor\Modules\AtomicWidgets\Controls\Types\Link_Control; |
| 14 | 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; | |
| 15 | 15 | use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type; |
| 16 | -use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type; | |
| 17 | 16 | use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type; |
| 18 | -use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type; | |
| 19 | 17 | |
| 20 | 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 21 | 19 | exit; // Exit if accessed directly. |
| 22 | 20 | } |
| @@ -21,17 +19,10 @@ | ||
| 21 | 19 | exit; // Exit if accessed directly. |
| 22 | 20 | } |
| 23 | 21 | |
| 24 | 22 | class Flexbox extends Atomic_Element_Base { |
| 25 | - use Has_Element_Template; | |
| 26 | - | |
| 27 | 23 | const BASE_STYLE_KEY = 'base'; |
| 28 | 24 | |
| 29 | - public function __construct( $data = [], $args = null ) { | |
| 30 | - parent::__construct( $data, $args ); | |
| 31 | - $this->meta( 'is_container', true ); | |
| 32 | - } | |
| 33 | - | |
| 34 | 25 | public static function get_type() { |
| 35 | 26 | return 'e-flexbox'; |
| 36 | 27 | } |
| 37 | 28 | |
| @@ -43,9 +34,9 @@ | ||
| 43 | 34 | return esc_html__( 'Flexbox', 'elementor' ); |
| 44 | 35 | } |
| 45 | 36 | |
| 46 | 37 | public function get_keywords() { |
| 47 | - return [ 'ato', 'atom', 'atoms', 'atomic', 'layout' ]; | |
| 38 | + return [ 'ato', 'atom', 'atoms', 'atomic' ]; | |
| 48 | 39 | } |
| 49 | 40 | |
| 50 | 41 | public function get_icon() { |
| 51 | 42 | return 'eicon-flexbox'; |
| @@ -51,19 +42,10 @@ | ||
| 51 | 42 | return 'eicon-flexbox'; |
| 52 | 43 | } |
| 53 | 44 | |
| 54 | 45 | protected static function define_props_schema(): array { |
| 55 | - $tag_dependencies = Dependency_Manager::make( Dependency_Manager::RELATION_AND ) | |
| 46 | + $tag_dependencies = Dependency_Manager::make() | |
| 56 | 47 | ->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 | 48 | 'operator' => 'not_exist', |
| 67 | 49 | 'path' => [ 'link', 'destination' ], |
| 68 | 50 | 'newValue' => [ |
| 69 | 51 | '$$type' => 'string', |
| @@ -68,23 +50,22 @@ | ||
| 68 | 50 | 'newValue' => [ |
| 69 | 51 | '$$type' => 'string', |
| 70 | 52 | 'value' => 'a', |
| 71 | 53 | ], |
| 72 | - ] )->get(); | |
| 54 | + ] ) | |
| 55 | + ->get(); | |
| 73 | 56 | |
| 74 | 57 | return [ |
| 75 | 58 | 'classes' => Classes_Prop_Type::make() |
| 76 | 59 | ->default( [] ), |
| 77 | 60 | 'tag' => String_Prop_Type::make() |
| 78 | - ->enum( [ 'div', 'header', 'section', 'article', 'aside', 'footer', 'a', 'button' ] ) | |
| 61 | + ->enum( [ 'div', 'header', 'section', 'article', 'aside', 'footer', 'a' ] ) | |
| 79 | 62 | ->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 ), | |
| 63 | + ->set_dependencies( $tag_dependencies ) | |
| 64 | + ->description( 'The HTML tag for the flexbox container. Could be div, header, section, article, aside, footer, or a (link).' ), | |
| 82 | 65 | 'link' => Link_Prop_Type::make(), |
| 83 | - 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ), | |
| 66 | + 'attributes' => Attributes_Prop_Type::make(), | |
| 84 | 67 | ]; |
| 85 | - | |
| 86 | - return $schema; | |
| 87 | 68 | } |
| 88 | 69 | |
| 89 | 70 | protected function define_atomic_controls(): array { |
| 90 | 71 | return [ |
| @@ -177,17 +158,10 @@ | ||
| 177 | 158 | $attributes['id'] = esc_attr( $settings['_cssid'] ); |
| 178 | 159 | } |
| 179 | 160 | |
| 180 | 161 | if ( ! empty( $settings['link']['href'] ) ) { |
| 181 | - $link_attributes = $this->get_link_attributes( $settings['link'] ); | |
| 182 | - $attributes = array_merge( $attributes, $link_attributes ); | |
| 162 | + $attributes = array_merge( $attributes, $settings['link'] ); | |
| 183 | 163 | } |
| 184 | 164 | |
| 185 | 165 | $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 | - ]; | |
| 192 | 166 | } |
| 193 | 167 | } |