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-content.php

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

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