← All changes
|
modules/atomic-widgets/elements/div-block/div-block.php
+8
-46
4.3.0-beta3
→
3.33.0-beta1
View file →
| @@ -1,10 +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; | |
| 6 | -use Elementor\Modules\AtomicWidgets\Elements\Base\Html_Tag_Computer; | |
| 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\PropTypes\Attributes_Prop_Type; |
| @@ -15,9 +13,8 @@ | ||
| 15 | 13 | use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control; |
| 16 | 14 | use Elementor\Modules\AtomicWidgets\PropDependencies\Manager as Dependency_Manager; |
| 17 | 15 | use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type; |
| 18 | 16 | use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type; |
| 19 | -use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type; | |
| 20 | 17 | |
| 21 | 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 22 | 19 | exit; // Exit if accessed directly. |
| 23 | 20 | } |
| @@ -22,17 +19,10 @@ | ||
| 22 | 19 | exit; // Exit if accessed directly. |
| 23 | 20 | } |
| 24 | 21 | |
| 25 | 22 | class Div_Block extends Atomic_Element_Base { |
| 26 | - use Has_Element_Template; | |
| 27 | - | |
| 28 | 23 | const BASE_STYLE_KEY = 'base'; |
| 29 | 24 | |
| 30 | - public function __construct( $data = [], $args = null ) { | |
| 31 | - parent::__construct( $data, $args ); | |
| 32 | - $this->meta( 'is_container', true ); | |
| 33 | - } | |
| 34 | - | |
| 35 | 25 | public static function get_type() { |
| 36 | 26 | return 'e-div-block'; |
| 37 | 27 | } |
| 38 | 28 | |
| @@ -44,9 +34,9 @@ | ||
| 44 | 34 | return esc_html__( 'Div block', 'elementor' ); |
| 45 | 35 | } |
| 46 | 36 | |
| 47 | 37 | public function get_keywords() { |
| 48 | - return [ 'ato', 'atom', 'atoms', 'atomic', 'container', 'wrapper', 'section', 'row', 'column', 'div', 'box', 'layout' ]; | |
| 38 | + return [ 'ato', 'atom', 'atoms', 'atomic' ]; | |
| 49 | 39 | } |
| 50 | 40 | |
| 51 | 41 | public function get_icon() { |
| 52 | 42 | return 'eicon-div-block'; |
| @@ -51,24 +41,11 @@ | ||
| 51 | 41 | public function get_icon() { |
| 52 | 42 | return 'eicon-div-block'; |
| 53 | 43 | } |
| 54 | 44 | |
| 55 | - public static function get_computed_html_tag( array $settings ): string { | |
| 56 | - return Html_Tag_Computer::compute( $settings, 'div' ); | |
| 57 | - } | |
| 58 | - | |
| 59 | 45 | protected static function define_props_schema(): array { |
| 60 | - $tag_dependencies = Dependency_Manager::make( Dependency_Manager::RELATION_AND ) | |
| 46 | + $tag_dependencies = Dependency_Manager::make() | |
| 61 | 47 | ->where( [ |
| 62 | - 'operator' => 'ne', | |
| 63 | - 'path' => [ 'link', 'destination' ], | |
| 64 | - 'nestedPath' => [ 'group' ], | |
| 65 | - 'value' => 'action', | |
| 66 | - 'newValue' => [ | |
| 67 | - '$$type' => 'string', | |
| 68 | - 'value' => 'button', | |
| 69 | - ], | |
| 70 | - ] )->where( [ | |
| 71 | 48 | 'operator' => 'not_exist', |
| 72 | 49 | 'path' => [ 'link', 'destination' ], |
| 73 | 50 | 'newValue' => [ |
| 74 | 51 | '$$type' => 'string', |
| @@ -73,20 +50,20 @@ | ||
| 73 | 50 | 'newValue' => [ |
| 74 | 51 | '$$type' => 'string', |
| 75 | 52 | 'value' => 'a', |
| 76 | 53 | ], |
| 77 | - ] )->get(); | |
| 54 | + ] ) | |
| 55 | + ->get(); | |
| 78 | 56 | |
| 79 | 57 | return [ |
| 80 | 58 | 'classes' => Classes_Prop_Type::make() |
| 81 | 59 | ->default( [] ), |
| 82 | 60 | 'tag' => String_Prop_Type::make() |
| 83 | - ->enum( [ 'div', 'header', 'section', 'article', 'aside', 'footer', 'a', 'button', 'main', 'nav' ] ) | |
| 61 | + ->enum( [ 'div', 'header', 'section', 'article', 'aside', 'footer', 'a' ] ) | |
| 84 | 62 | ->default( 'div' ) |
| 85 | - ->description( 'The HTML tag for the div block container. One of: div, header, section, article, aside, footer, main, nav, a (link), or button. Do not use heading or paragraph tags.' ) | |
| 86 | 63 | ->set_dependencies( $tag_dependencies ), |
| 87 | 64 | 'link' => Link_Prop_Type::make(), |
| 88 | - 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ), | |
| 65 | + 'attributes' => Attributes_Prop_Type::make(), | |
| 89 | 66 | ]; |
| 90 | 67 | } |
| 91 | 68 | |
| 92 | 69 | protected function define_atomic_controls(): array { |
| @@ -120,16 +97,8 @@ | ||
| 120 | 97 | [ |
| 121 | 98 | 'value' => 'footer', |
| 122 | 99 | 'label' => 'Footer', |
| 123 | 100 | ], |
| 124 | - [ | |
| 125 | - 'value' => 'main', | |
| 126 | - 'label' => 'Main', | |
| 127 | - ], | |
| 128 | - [ | |
| 129 | - 'value' => 'nav', | |
| 130 | - 'label' => 'Nav', | |
| 131 | - ], | |
| 132 | 101 | ]) |
| 133 | 102 | ->set_fallback_labels( [ |
| 134 | 103 | 'a' => 'a (link)', |
| 135 | 104 | ] ) |
| @@ -194,17 +163,10 @@ | ||
| 194 | 163 | $attributes['id'] = esc_attr( $settings['_cssid'] ); |
| 195 | 164 | } |
| 196 | 165 | |
| 197 | 166 | if ( ! empty( $settings['link']['href'] ) ) { |
| 198 | - $link_attributes = $this->get_link_attributes( $settings['link'] ); | |
| 199 | - $attributes = array_merge( $attributes, $link_attributes ); | |
| 167 | + $attributes = array_merge( $attributes, $settings['link'] ); | |
| 200 | 168 | } |
| 201 | 169 | |
| 202 | 170 | $this->add_render_attribute( '_wrapper', array_merge( $initial_attributes, $attributes ) ); |
| 203 | - } | |
| 204 | - | |
| 205 | - protected function get_templates(): array { | |
| 206 | - return [ | |
| 207 | - 'elementor/elements/div-block' => __DIR__ . '/div-block.html.twig', | |
| 208 | - ]; | |
| 209 | 171 | } |
| 210 | 172 | } |