PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.3
Elementor Website Builder – more than just a page builder v4.0.3
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
elementor / modules / atomic-widgets / elements / atomic-divider / atomic-divider.php

atomic-divider.php in Elementor Website Builder – more than just a page builder 4.0.3, at modules/atomic-widgets/elements/atomic-divider/atomic-divider.php

109 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\AtomicWidgets\Elements\Atomic_Divider;
4
5 use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Widget_Base;
6 use Elementor\Modules\AtomicWidgets\Elements\Base\Has_Template;
7 use Elementor\Modules\AtomicWidgets\PropTypes\Background_Prop_Type;
8 use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type;
9 use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type;
10 use Elementor\Modules\AtomicWidgets\PropTypes\Color_Prop_Type;
11 use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
12 use Elementor\Modules\AtomicWidgets\Styles\Style_Definition;
13 use Elementor\Modules\AtomicWidgets\Styles\Style_Variant;
14 use Elementor\Modules\AtomicWidgets\Controls\Section;
15 use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control;
16 use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type;
17
18 if ( ! defined( 'ABSPATH' ) ) {
19 exit;
20 }
21
22 class Atomic_Divider extends Atomic_Widget_Base {
23
24 use Has_Template;
25
26 protected function get_css_id_control_meta(): array {
27 return [
28 'layout' => 'two-columns',
29 'topDivider' => false,
30 ];
31 }
32
33 public static function get_element_type(): string {
34 return 'e-divider';
35 }
36
37 public function get_title() {
38 return esc_html__( 'Divider', 'elementor' );
39 }
40
41 public function get_keywords() {
42 return [ 'ato', 'atom', 'atoms', 'atomic', 'divider', 'hr', 'line', 'border', 'separator' ];
43 }
44
45 public function get_icon() {
46 return 'eicon-e-divider';
47 }
48
49 protected static function define_props_schema(): array {
50 return [
51 'classes' => Classes_Prop_Type::make()
52 ->default( [] ),
53
54 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ),
55 ];
56 }
57
58 protected function define_atomic_controls(): array {
59 return [
60 Section::make()
61 ->set_label( __( 'Settings', 'elementor' ) )
62 ->set_id( 'settings' )
63 ->set_items( $this->get_settings_controls() ),
64 ];
65 }
66
67 protected function get_settings_controls(): array {
68 return [
69 Text_Control::bind_to( '_cssid' )
70 ->set_label( __( 'ID', 'elementor' ) )
71 ->set_meta( $this->get_css_id_control_meta() ),
72 ];
73 }
74
75 protected function define_base_styles(): array {
76 $border_width_value = Size_Prop_Type::generate([
77 'size' => 0,
78 'unit' => 'px',
79 ]);
80
81 $height_value = Size_Prop_Type::generate([
82 'size' => 1,
83 'unit' => 'px',
84 ]);
85
86 $background_value = Background_Prop_Type::generate([
87 'color' => Color_Prop_Type::generate( '#000' ),
88 ]);
89
90 return [
91 'base' => Style_Definition::make()
92 ->add_variant(
93 Style_Variant::make()
94 ->add_prop( 'border-width', $border_width_value )
95 ->add_prop( 'border-color', 'transparent' )
96 ->add_prop( 'border-style', 'none' )
97 ->add_prop( 'background', $background_value )
98 ->add_prop( 'height', $height_value )
99 ),
100 ];
101 }
102
103 protected function get_templates(): array {
104 return [
105 'elementor/elements/atomic-divider' => __DIR__ . '/atomic-divider.html.twig',
106 ];
107 }
108 }
109