PluginProbe
Elementor Website Builder – more than just a page builder / 3.32.0
Elementor Website Builder – more than just a page builder v3.32.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 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-tab-link.php

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

113 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 use Elementor\Modules\AtomicWidgets\Elements\Atomic_Heading\Atomic_Heading;
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit; // Exit if accessed directly.
16 }
17
18 class Atomic_Tab_Link extends Atomic_Element_Base {
19 const BASE_STYLE_KEY = 'base';
20
21 public static function get_type() {
22 return 'e-tab-link';
23 }
24
25 public static function get_element_type(): string {
26 return 'e-tab-link';
27 }
28
29 public function get_title() {
30 return esc_html__( 'Atomic Tab Link', '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 $padding = Size_Prop_Type::generate( [
68 'size' => 4,
69 'unit' => 'px',
70 ] );
71
72 return [
73 static::BASE_STYLE_KEY => Style_Definition::make()
74 ->add_variant(
75 Style_Variant::make()
76 ->add_prop( 'display', $display )
77 ->add_prop( 'padding', $padding )
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
87 $attributes = [
88 'class' => [
89 'e-con',
90 'e-atomic-element',
91 $base_style_class,
92 ...( $settings['classes'] ?? [] ),
93 ],
94 ];
95
96 if ( ! empty( $settings['_cssid'] ) ) {
97 $attributes['id'] = esc_attr( $settings['_cssid'] );
98 }
99
100 $this->add_render_attribute( '_wrapper', $attributes );
101 }
102
103 protected function define_default_children() {
104 return [
105 Atomic_Heading::generate()
106 ->settings( [
107 'title' => String_Prop_Type::generate( 'Tab' ),
108 ] )
109 ->build(),
110 ];
111 }
112 }
113