← All changes
|
modules/atomic-widgets/elements/div-block/div-block.php
+8
-32
4.2.0-dev2
→
3.33.0-beta1
View file →
| @@ -1,9 +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; | |
| 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\PropTypes\Attributes_Prop_Type; |
| @@ -14,9 +13,8 @@ | ||
| 14 | 13 | use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control; |
| 15 | 14 | use Elementor\Modules\AtomicWidgets\PropDependencies\Manager as Dependency_Manager; |
| 16 | 15 | 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 Div_Block 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-div-block'; |
| 36 | 27 | } |
| 37 | 28 | |
| @@ -43,9 +34,9 @@ | ||
| 43 | 34 | return esc_html__( 'Div block', '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-div-block'; |
| @@ -51,19 +42,10 @@ | ||
| 51 | 42 | return 'eicon-div-block'; |
| 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,19 +50,20 @@ | ||
| 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 | 63 | ->set_dependencies( $tag_dependencies ), |
| 81 | 64 | 'link' => Link_Prop_Type::make(), |
| 82 | - 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ), | |
| 65 | + 'attributes' => Attributes_Prop_Type::make(), | |
| 83 | 66 | ]; |
| 84 | 67 | } |
| 85 | 68 | |
| 86 | 69 | protected function define_atomic_controls(): array { |
| @@ -180,17 +163,10 @@ | ||
| 180 | 163 | $attributes['id'] = esc_attr( $settings['_cssid'] ); |
| 181 | 164 | } |
| 182 | 165 | |
| 183 | 166 | if ( ! empty( $settings['link']['href'] ) ) { |
| 184 | - $link_attributes = $this->get_link_attributes( $settings['link'] ); | |
| 185 | - $attributes = array_merge( $attributes, $link_attributes ); | |
| 167 | + $attributes = array_merge( $attributes, $settings['link'] ); | |
| 186 | 168 | } |
| 187 | 169 | |
| 188 | 170 | $this->add_render_attribute( '_wrapper', array_merge( $initial_attributes, $attributes ) ); |
| 189 | - } | |
| 190 | - | |
| 191 | - protected function get_templates(): array { | |
| 192 | - return [ | |
| 193 | - 'elementor/elements/div-block' => __DIR__ . '/div-block.html.twig', | |
| 194 | - ]; | |
| 195 | 171 | } |
| 196 | 172 | } |