PluginProbe
Elementor Website Builder – more than just a page builder / 3.33.0-beta1
Elementor Website Builder – more than just a page builder v3.33.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 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 All 457 releases
elementor / modules / atomic-widgets / elements / atomic-tabs / atomic-tabs-list.php

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

112 lines 3.0 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 use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type;
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit; // Exit if accessed directly.
16 }
17
18 class Atomic_Tabs_List extends Atomic_Element_Base {
19 const BASE_STYLE_KEY = 'base';
20
21 public static function get_type() {
22 return 'e-tabs-list';
23 }
24
25 public static function get_element_type(): string {
26 return 'e-tabs-list';
27 }
28
29 public function get_title() {
30 return esc_html__( 'Atomic Tabs List', '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 public function should_show_in_panel() {
42 return false;
43 }
44
45 protected static function define_props_schema(): array {
46 return [
47 'classes' => Classes_Prop_Type::make()
48 ->default( [] ),
49 'attributes' => Attributes_Prop_Type::make(),
50 ];
51 }
52
53 protected function define_atomic_controls(): array {
54 return [
55 Section::make()
56 ->set_label( __( 'Settings', 'elementor' ) )
57 ->set_id( 'settings' )
58 ->set_items( [
59 Text_Control::bind_to( '_cssid' )
60 ->set_label( __( 'ID', 'elementor' ) )
61 ->set_meta( $this->get_css_id_control_meta() ),
62 ] ),
63 ];
64 }
65
66 protected function define_base_styles(): array {
67 $display = String_Prop_Type::generate( 'flex' );
68 $gap = Size_Prop_Type::generate( [
69 'size' => 10,
70 'unit' => 'px',
71 ] );
72 $justify_content = String_Prop_Type::generate( 'space-between' );
73 $min_width = Size_Prop_Type::generate( [
74 'size' => 30,
75 'unit' => 'px',
76 ] );
77
78 return [
79 static::BASE_STYLE_KEY => Style_Definition::make()
80 ->add_variant(
81 Style_Variant::make()
82 ->add_prop( 'display', $display )
83 ->add_prop( 'min-width', $min_width )
84 ->add_prop( 'gap', $gap )
85 ->add_prop( 'justify-content', $justify_content )
86 ),
87 ];
88 }
89
90 protected function add_render_attributes() {
91 parent::add_render_attributes();
92 $settings = $this->get_atomic_settings();
93 $base_style_class = $this->get_base_styles_dictionary()[ static::BASE_STYLE_KEY ];
94 $initial_attributes = $this->define_initial_attributes();
95
96 $attributes = [
97 'class' => [
98 'e-con',
99 'e-atomic-element',
100 $base_style_class,
101 ...( $settings['classes'] ?? [] ),
102 ],
103 ];
104
105 if ( ! empty( $settings['_cssid'] ) ) {
106 $attributes['id'] = esc_attr( $settings['_cssid'] );
107 }
108
109 $this->add_render_attribute( '_wrapper', array_merge( $initial_attributes, $attributes ) );
110 }
111 }
112