PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
4.3.0-beta3 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 All 452 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.3.0-beta3, at modules/atomic-widgets/elements/atomic-divider/atomic-divider.php

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