PluginProbe
Elementor Website Builder – more than just a page builder / 3.32.4
Elementor Website Builder – more than just a page builder v3.32.4
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-tabs / atomic-tabs.php

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

121 lines 2.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Modules\AtomicWidgets\Elements\Atomic_Tabs;
3
4 use Elementor\Modules\AtomicWidgets\Elements\Atomic_Element_Base;
5 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
6 use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
7 use Elementor\Modules\AtomicWidgets\Styles\Style_Definition;
8 use Elementor\Modules\AtomicWidgets\Styles\Style_Variant;
9 use Elementor\Modules\AtomicWidgets\Controls\Section;
10 use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control;
11 use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type;
12
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit; // Exit if accessed directly.
16 }
17
18 class Atomic_Tabs extends Atomic_Element_Base {
19 const BASE_STYLE_KEY = 'base';
20
21 public static function get_type() {
22 return 'e-tabs';
23 }
24
25 public static function get_element_type(): string {
26 return 'e-tabs';
27 }
28
29 public function get_title() {
30 return esc_html__( 'Atomic Tabs', 'elementor' );
31 }
32
33 public function get_keywords() {
34 return [ 'ato', 'atom', 'atoms', 'atomic' ];
35 }
36
37 public function get_icon() {
38 return 'eicon-tabs';
39 }
40
41 protected static function define_props_schema(): array {
42 return [
43 'classes' => Classes_Prop_Type::make()
44 ->default( [] ),
45 ];
46 }
47
48 protected function define_atomic_controls(): array {
49 return [
50 Section::make()
51 ->set_label( __( 'Settings', 'elementor' ) )
52 ->set_id( 'settings' )
53 ->set_items( [
54 Text_Control::bind_to( '_cssid' )
55 ->set_label( __( 'ID', 'elementor' ) )
56 ->set_meta( $this->get_css_id_control_meta() ),
57 ] ),
58 ];
59 }
60
61 protected function define_base_styles(): array {
62 $display = String_Prop_Type::generate( 'block' );
63
64 return [
65 static::BASE_STYLE_KEY => Style_Definition::make()
66 ->add_variant(
67 Style_Variant::make()
68 ->add_prop( 'display', $display )
69 ->add_prop( 'padding', $this->get_base_padding() )
70 ->add_prop( 'min-width', $this->get_base_min_width() )
71 ),
72 ];
73 }
74
75 protected function get_base_padding(): array {
76 return Size_Prop_Type::generate( [
77 'size' => 10,
78 'unit' => 'px',
79 ] );
80 }
81
82 protected function get_base_min_width(): array {
83 return Size_Prop_Type::generate( [
84 'size' => 30,
85 'unit' => 'px',
86 ] );
87 }
88
89 protected function add_render_attributes() {
90 parent::add_render_attributes();
91 $settings = $this->get_atomic_settings();
92 $base_style_class = $this->get_base_styles_dictionary()[ static::BASE_STYLE_KEY ];
93
94 $attributes = [
95 'class' => [
96 'e-con',
97 'e-atomic-element',
98 $base_style_class,
99 ...( $settings['classes'] ?? [] ),
100 ],
101 ];
102
103 if ( ! empty( $settings['_cssid'] ) ) {
104 $attributes['id'] = esc_attr( $settings['_cssid'] );
105 }
106
107 $this->add_render_attribute( '_wrapper', $attributes );
108 }
109
110 protected function define_default_children() {
111 return [
112 Atomic_Tab_List::generate()
113 ->is_locked( true )
114 ->build(),
115 Atomic_Tabs_Content::generate()
116 ->is_locked( true )
117 ->build(),
118 ];
119 }
120 }
121