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
elementor / modules / atomic-widgets / elements / atomic-divider / atomic-divider.php

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

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