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

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

104 lines 2.6 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\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
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit; // Exit if accessed directly.
15 }
16
17 class Atomic_Tabs_Menu extends Atomic_Element_Base {
18 const BASE_STYLE_KEY = 'base';
19
20 public static function get_type() {
21 return 'e-tabs-menu';
22 }
23
24 public static function get_element_type(): string {
25 return 'e-tabs-menu';
26 }
27
28 public function get_title() {
29 return esc_html__( 'Tabs menu', 'elementor' );
30 }
31
32 public function get_keywords() {
33 return [ 'ato', 'atom', 'atoms', 'atomic' ];
34 }
35
36 public function get_icon() {
37 return 'eicon-tab-menu';
38 }
39
40 public function should_show_in_panel() {
41 return false;
42 }
43
44 protected static function define_props_schema(): array {
45 return [
46 'classes' => Classes_Prop_Type::make()
47 ->default( [] ),
48 'attributes' => Attributes_Prop_Type::make(),
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( [
61 'layout' => 'two-columns',
62 ] ),
63 ] ),
64 ];
65 }
66
67 protected function define_base_styles(): array {
68 $styles = [
69 'display' => String_Prop_Type::generate( 'flex' ),
70 'justify-content' => String_Prop_Type::generate( 'center' ),
71 ];
72
73 return [
74 static::BASE_STYLE_KEY => Style_Definition::make()
75 ->add_variant(
76 Style_Variant::make()
77 ->add_props( $styles )
78 ),
79 ];
80 }
81
82 protected function add_render_attributes() {
83 parent::add_render_attributes();
84 $settings = $this->get_atomic_settings();
85 $base_style_class = $this->get_base_styles_dictionary()[ static::BASE_STYLE_KEY ];
86 $initial_attributes = $this->define_initial_attributes();
87
88 $attributes = [
89 'class' => [
90 'e-con',
91 'e-atomic-element',
92 $base_style_class,
93 ...( $settings['classes'] ?? [] ),
94 ],
95 ];
96
97 if ( ! empty( $settings['_cssid'] ) ) {
98 $attributes['id'] = esc_attr( $settings['_cssid'] );
99 }
100
101 $this->add_render_attribute( '_wrapper', array_merge( $initial_attributes, $attributes ) );
102 }
103 }
104