PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.0-dev2
Elementor Website Builder – more than just a page builder v3.28.0-dev2
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 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 All 453 releases
← All changes | modules/atomic-widgets/elements/atomic-button/atomic-button.php +30 -66 4.1.33.28.0-dev2 View file →
@@ -2,17 +2,14 @@
2 2
3 3 namespace Elementor\Modules\AtomicWidgets\Elements\Atomic_Button;
4 4
5 5 use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control;
6 -use Elementor\Modules\AtomicWidgets\Controls\Types\Inline_Editing_Control;
7 -use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Widget_Base;
6 +use Elementor\Modules\AtomicWidgets\Elements\Atomic_Widget_Base;
8 7 use Elementor\Modules\AtomicWidgets\Controls\Section;
9 8 use Elementor\Modules\AtomicWidgets\Controls\Types\Link_Control;
10 -use Elementor\Modules\AtomicWidgets\Elements\Base\Has_Template;
9 +use Elementor\Modules\AtomicWidgets\Elements\Has_Template;
11 10 use Elementor\Modules\AtomicWidgets\PropTypes\Background_Prop_Type;
12 -use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type;
13 11 use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type;
14 -use Elementor\Modules\AtomicWidgets\PropTypes\Html_V3_Prop_Type;
15 12 use Elementor\Modules\AtomicWidgets\PropTypes\Color_Prop_Type;
16 13 use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type;
17 14 use Elementor\Modules\AtomicWidgets\PropTypes\Dimensions_Prop_Type;
18 15 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
@@ -18,9 +15,9 @@
18 15 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
19 16 use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
20 17 use Elementor\Modules\AtomicWidgets\Styles\Style_Definition;
21 18 use Elementor\Modules\AtomicWidgets\Styles\Style_Variant;
22 -use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type;
19 +use Elementor\Modules\WpRest\Classes\WP_Post;
23 20
24 21 if ( ! defined( 'ABSPATH' ) ) {
25 22 exit;
26 23 }
@@ -28,45 +25,29 @@
28 25 class Atomic_Button extends Atomic_Widget_Base {
29 26 use Has_Template;
30 27
31 28 public static function get_element_type(): string {
32 - return 'e-button';
29 + return 'a-button';
33 30 }
34 31
35 32 public function get_title() {
36 - return esc_html__( 'Button', 'elementor' );
33 + return esc_html__( 'Atomic Button', 'elementor' );
37 34 }
38 35
39 - public function get_keywords() {
40 - return [ 'ato', 'atom', 'atoms', 'atomic' ];
41 - }
42 -
43 36 public function get_icon() {
44 37 return 'eicon-e-button';
45 38 }
46 39
47 40 protected static function define_props_schema(): array {
48 - $props = [
41 + return [
49 42 'classes' => Classes_Prop_Type::make()
50 43 ->default( [] ),
51 44
52 - 'text' => Html_V3_Prop_Type::make()
53 - ->default( [
54 - 'content' => String_Prop_Type::generate( __( 'Click here', 'elementor' ) ),
55 - 'children' => [],
56 - ] )
57 - ->description( 'The text displayed on the button.' ),
45 + 'text' => String_Prop_Type::make()
46 + ->default( __( 'Click here', 'elementor' ) ),
58 47
59 48 'link' => Link_Prop_Type::make(),
60 -
61 - 'tag' => String_Prop_Type::make()
62 - ->default( 'button' )
63 - ->description( 'The HTML tag for the button element.' ),
64 -
65 - 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ),
66 49 ];
67 -
68 - return $props;
69 50 }
70 51
71 52 protected function define_atomic_controls(): array {
72 53 return [
@@ -72,49 +53,42 @@
72 53 return [
73 54 Section::make()
74 55 ->set_label( __( 'Content', 'elementor' ) )
75 56 ->set_items( [
76 - Inline_Editing_Control::bind_to( 'text' )
77 - ->set_placeholder( __( 'Type your button text here', 'elementor' ) )
78 - ->set_label( __( 'Button text', 'elementor' ) ),
57 + Text_Control::bind_to( 'text' )
58 + ->set_label( __( 'Button text', 'elementor' ) )
59 + ->set_placeholder( __( 'Type your button text here', 'elementor' ) ),
60 +
61 + Link_Control::bind_to( 'link' ),
79 62 ] ),
80 - Section::make()
81 - ->set_label( __( 'Settings', 'elementor' ) )
82 - ->set_id( 'settings' )
83 - ->set_items( $this->get_settings_controls() ),
84 63 ];
85 64 }
86 65
87 - protected function get_settings_controls(): array {
88 - return [
89 - Link_Control::bind_to( 'link' )
90 - ->set_placeholder( __( 'Type or paste your URL', 'elementor' ) )
91 - ->set_label( __( 'Link', 'elementor' ) ),
92 - Text_Control::bind_to( '_cssid' )
93 - ->set_label( __( 'ID', 'elementor' ) )
94 - ->set_meta( $this->get_css_id_control_meta() ),
95 - ];
96 - }
97 -
98 66 protected function define_base_styles(): array {
67 + $color_value = Color_Prop_Type::generate( 'white' );
68 + $font_family_value = String_Prop_Type::generate( 'Poppins' );
69 + $font_size_value = Size_Prop_Type::generate( [
70 + 'size' => 16,
71 + 'unit' => 'px',
72 + ] );
99 73 $background_color_value = Background_Prop_Type::generate( [
100 74 'color' => Color_Prop_Type::generate( '#375EFB' ),
101 75 ] );
102 76 $display_value = String_Prop_Type::generate( 'inline-block' );
103 77 $padding_value = Dimensions_Prop_Type::generate( [
104 - 'block-start' => Size_Prop_Type::generate( [
78 + 'top' => Size_Prop_Type::generate( [
105 79 'size' => 12,
106 80 'unit' => 'px',
107 81 ]),
108 - 'inline-end' => Size_Prop_Type::generate( [
82 + 'right' => Size_Prop_Type::generate( [
109 83 'size' => 24,
110 84 'unit' => 'px',
111 85 ]),
112 - 'block-end' => Size_Prop_Type::generate( [
86 + 'bottom' => Size_Prop_Type::generate( [
113 87 'size' => 12,
114 88 'unit' => 'px',
115 89 ]),
116 - 'inline-start' => Size_Prop_Type::generate( [
90 + 'left' => Size_Prop_Type::generate( [
117 91 'size' => 24,
118 92 'unit' => 'px',
119 93 ]),
120 94 ]);
@@ -125,20 +99,25 @@
125 99 $border_width_value = Size_Prop_Type::generate( [
126 100 'size' => 0,
127 101 'unit' => 'px',
128 102 ] );
129 - $align_text_value = String_Prop_Type::generate( 'center' );
103 + $text_align_value = String_Prop_Type::generate( 'center' );
104 + $font_weight_value = String_Prop_Type::generate( '500' );
130 105
131 106 return [
132 107 'base' => Style_Definition::make()
133 108 ->add_variant(
134 109 Style_Variant::make()
110 + ->add_prop( 'color', $color_value )
111 + ->add_prop( 'font-family', $font_family_value )
112 + ->add_prop( 'font-size', $font_size_value )
135 113 ->add_prop( 'background', $background_color_value )
136 114 ->add_prop( 'display', $display_value )
115 + ->add_prop( 'font-weight', $font_weight_value )
137 116 ->add_prop( 'padding', $padding_value )
117 + ->add_prop( 'text-align', $text_align_value )
138 118 ->add_prop( 'border-radius', $border_radius_value )
139 119 ->add_prop( 'border-width', $border_width_value )
140 - ->add_prop( 'text-align', $align_text_value )
141 120 ),
142 121 ];
143 122 }
144 123
@@ -145,21 +124,6 @@
145 124 protected function get_templates(): array {
146 125 return [
147 126 'elementor/elements/atomic-button' => __DIR__ . '/atomic-button.html.twig',
148 127 ];
149 - }
150 -
151 - public function render_markdown(): string {
152 - $settings = $this->get_atomic_settings();
153 - $text = wp_strip_all_tags( $settings['text'] ?? '' );
154 -
155 - if ( empty( $text ) ) {
156 - return '';
157 - }
158 -
159 - if ( ! empty( $settings['link']['href'] ) ) {
160 - return '[' . $text . '](' . esc_url( $settings['link']['href'] ) . ')';
161 - }
162 -
163 - return '**' . $text . '**';
164 128 }
165 129 }