← All changes
|
modules/atomic-widgets/elements/atomic-button/atomic-button.php
+7
-38
4.3.0-beta3
→
3.32.0-dev3
View file →
| @@ -2,18 +2,15 @@ | ||
| 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; | |
| 11 | -use Elementor\Modules\AtomicWidgets\Elements\Base\Html_Tag_Computer; | |
| 9 | +use Elementor\Modules\AtomicWidgets\Elements\Has_Template; | |
| 12 | 10 | use Elementor\Modules\AtomicWidgets\PropTypes\Background_Prop_Type; |
| 13 | 11 | use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type; |
| 14 | 12 | use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type; |
| 15 | -use Elementor\Modules\AtomicWidgets\PropTypes\Escaped_Html_Prop_Type; | |
| 16 | 13 | use Elementor\Modules\AtomicWidgets\PropTypes\Color_Prop_Type; |
| 17 | 14 | use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type; |
| 18 | 15 | use Elementor\Modules\AtomicWidgets\PropTypes\Dimensions_Prop_Type; |
| 19 | 16 | use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type; |
| @@ -19,9 +16,8 @@ | ||
| 19 | 16 | use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type; |
| 20 | 17 | use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type; |
| 21 | 18 | use Elementor\Modules\AtomicWidgets\Styles\Style_Definition; |
| 22 | 19 | use Elementor\Modules\AtomicWidgets\Styles\Style_Variant; |
| 23 | -use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type; | |
| 24 | 20 | |
| 25 | 21 | if ( ! defined( 'ABSPATH' ) ) { |
| 26 | 22 | exit; |
| 27 | 23 | } |
| @@ -37,9 +33,9 @@ | ||
| 37 | 33 | return esc_html__( 'Button', 'elementor' ); |
| 38 | 34 | } |
| 39 | 35 | |
| 40 | 36 | public function get_keywords() { |
| 41 | - return [ 'ato', 'atom', 'atoms', 'atomic', 'button', 'cta', 'link', 'click' ]; | |
| 37 | + return [ 'ato', 'atom', 'atoms', 'atomic' ]; | |
| 42 | 38 | } |
| 43 | 39 | |
| 44 | 40 | public function get_icon() { |
| 45 | 41 | return 'eicon-e-button'; |
| @@ -44,29 +40,19 @@ | ||
| 44 | 40 | public function get_icon() { |
| 45 | 41 | return 'eicon-e-button'; |
| 46 | 42 | } |
| 47 | 43 | |
| 48 | - public static function get_computed_html_tag( array $settings ): string { | |
| 49 | - return Html_Tag_Computer::compute( $settings, 'button' ); | |
| 50 | - } | |
| 51 | - | |
| 52 | 44 | protected static function define_props_schema(): array { |
| 53 | 45 | $props = [ |
| 54 | 46 | 'classes' => Classes_Prop_Type::make() |
| 55 | 47 | ->default( [] ), |
| 56 | 48 | |
| 57 | - 'text' => Escaped_Html_Prop_Type::make() | |
| 58 | - ->default( __( 'Click here', 'elementor' ) ) | |
| 59 | - ->description( 'The text displayed on the button.' ) | |
| 60 | - ->alias( 'content', 'label' ), | |
| 49 | + 'text' => String_Prop_Type::make() | |
| 50 | + ->default( __( 'Click here', 'elementor' ) ), | |
| 61 | 51 | |
| 62 | 52 | 'link' => Link_Prop_Type::make(), |
| 63 | 53 | |
| 64 | - 'tag' => String_Prop_Type::make() | |
| 65 | - ->default( 'button' ) | |
| 66 | - ->description( 'The HTML tag for the button element.' ), | |
| 67 | - | |
| 68 | - 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ), | |
| 54 | + 'attributes' => Attributes_Prop_Type::make(), | |
| 69 | 55 | ]; |
| 70 | 56 | |
| 71 | 57 | return $props; |
| 72 | 58 | } |
| @@ -74,11 +60,10 @@ | ||
| 74 | 60 | protected function define_atomic_controls(): array { |
| 75 | 61 | return [ |
| 76 | 62 | Section::make() |
| 77 | 63 | ->set_label( __( 'Content', 'elementor' ) ) |
| 78 | - ->set_id( 'content' ) | |
| 79 | 64 | ->set_items( [ |
| 80 | - Inline_Editing_Control::bind_to( 'text' ) | |
| 65 | + Text_Control::bind_to( 'text' ) | |
| 81 | 66 | ->set_placeholder( __( 'Type your button text here', 'elementor' ) ) |
| 82 | 67 | ->set_label( __( 'Button text', 'elementor' ) ), |
| 83 | 68 | ] ), |
| 84 | 69 | Section::make() |
| @@ -90,9 +75,8 @@ | ||
| 90 | 75 | |
| 91 | 76 | protected function get_settings_controls(): array { |
| 92 | 77 | return [ |
| 93 | 78 | Link_Control::bind_to( 'link' ) |
| 94 | - ->set_placeholder( __( 'Type or paste your URL', 'elementor' ) ) | |
| 95 | 79 | ->set_label( __( 'Link', 'elementor' ) ), |
| 96 | 80 | Text_Control::bind_to( '_cssid' ) |
| 97 | 81 | ->set_label( __( 'ID', 'elementor' ) ) |
| 98 | 82 | ->set_meta( $this->get_css_id_control_meta() ), |
| @@ -149,21 +133,6 @@ | ||
| 149 | 133 | protected function get_templates(): array { |
| 150 | 134 | return [ |
| 151 | 135 | 'elementor/elements/atomic-button' => __DIR__ . '/atomic-button.html.twig', |
| 152 | 136 | ]; |
| 153 | - } | |
| 154 | - | |
| 155 | - public function render_markdown(): string { | |
| 156 | - $settings = $this->get_atomic_settings(); | |
| 157 | - $text = wp_strip_all_tags( $settings['text'] ?? '' ); | |
| 158 | - | |
| 159 | - if ( empty( $text ) ) { | |
| 160 | - return ''; | |
| 161 | - } | |
| 162 | - | |
| 163 | - if ( ! empty( $settings['link']['href'] ) ) { | |
| 164 | - return '[' . $text . '](' . esc_url( $settings['link']['href'] ) . ')'; | |
| 165 | - } | |
| 166 | - | |
| 167 | - return '**' . $text . '**'; | |
| 168 | 137 | } |
| 169 | 138 | } |