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

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

114 lines 2.8 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_Content extends Atomic_Element_Base {
19 const BASE_STYLE_KEY = 'base';
20
21 public static function get_type() {
22 return 'e-tabs-content';
23 }
24
25 public static function get_element_type(): string {
26 return 'e-tabs-content';
27 }
28
29 public function get_title() {
30 return esc_html__( 'Atomic Tabs Content', '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 ];
50 }
51
52 protected function define_atomic_controls(): array {
53 return [
54 Section::make()
55 ->set_label( __( 'Settings', 'elementor' ) )
56 ->set_id( 'settings' )
57 ->set_items( [
58 Text_Control::bind_to( '_cssid' )
59 ->set_label( __( 'ID', 'elementor' ) )
60 ->set_meta( $this->get_css_id_control_meta() ),
61 ] ),
62 ];
63 }
64
65 protected function define_base_styles(): array {
66 $display = String_Prop_Type::generate( 'block' );
67
68 return [
69 static::BASE_STYLE_KEY => Style_Definition::make()
70 ->add_variant(
71 Style_Variant::make()
72 ->add_prop( 'display', $display )
73 ->add_prop( 'padding', $this->get_base_padding() )
74 ->add_prop( 'min-width', $this->get_base_min_width() )
75 ),
76 ];
77 }
78
79 protected function get_base_padding(): array {
80 return Size_Prop_Type::generate( [
81 'size' => 10,
82 'unit' => 'px',
83 ] );
84 }
85
86 protected function get_base_min_width(): array {
87 return Size_Prop_Type::generate( [
88 'size' => 30,
89 'unit' => 'px',
90 ] );
91 }
92
93 protected function add_render_attributes() {
94 parent::add_render_attributes();
95 $settings = $this->get_atomic_settings();
96 $base_style_class = $this->get_base_styles_dictionary()[ static::BASE_STYLE_KEY ];
97
98 $attributes = [
99 'class' => [
100 'e-con',
101 'e-atomic-element',
102 $base_style_class,
103 ...( $settings['classes'] ?? [] ),
104 ],
105 ];
106
107 if ( ! empty( $settings['_cssid'] ) ) {
108 $attributes['id'] = esc_attr( $settings['_cssid'] );
109 }
110
111 $this->add_render_attribute( '_wrapper', $attributes );
112 }
113 }
114