PluginProbe
Elementor Website Builder – more than just a page builder / 3.35.0-dev3
Elementor Website Builder – more than just a page builder v3.35.0-dev3
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-menu.php

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

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