← All changes
|
modules/atomic-widgets/elements/atomic-button/atomic-button.php
+4
-32
4.3.0-beta3
→
3.35.0-dev2
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 | 6 | use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Widget_Base; |
| 8 | 7 | use Elementor\Modules\AtomicWidgets\Controls\Section; |
| 9 | 8 | use Elementor\Modules\AtomicWidgets\Controls\Types\Link_Control; |
| 10 | 9 | use Elementor\Modules\AtomicWidgets\Elements\Base\Has_Template; |
| 11 | -use Elementor\Modules\AtomicWidgets\Elements\Base\Html_Tag_Computer; | |
| 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; |
| @@ -37,9 +34,9 @@ | ||
| 37 | 34 | return esc_html__( 'Button', 'elementor' ); |
| 38 | 35 | } |
| 39 | 36 | |
| 40 | 37 | public function get_keywords() { |
| 41 | - return [ 'ato', 'atom', 'atoms', 'atomic', 'button', 'cta', 'link', 'click' ]; | |
| 38 | + return [ 'ato', 'atom', 'atoms', 'atomic' ]; | |
| 42 | 39 | } |
| 43 | 40 | |
| 44 | 41 | public function get_icon() { |
| 45 | 42 | return 'eicon-e-button'; |
| @@ -44,28 +41,19 @@ | ||
| 44 | 41 | public function get_icon() { |
| 45 | 42 | return 'eicon-e-button'; |
| 46 | 43 | } |
| 47 | 44 | |
| 48 | - public static function get_computed_html_tag( array $settings ): string { | |
| 49 | - return Html_Tag_Computer::compute( $settings, 'button' ); | |
| 50 | - } | |
| 51 | - | |
| 52 | 45 | protected static function define_props_schema(): array { |
| 53 | 46 | $props = [ |
| 54 | 47 | 'classes' => Classes_Prop_Type::make() |
| 55 | 48 | ->default( [] ), |
| 56 | 49 | |
| 57 | - 'text' => Escaped_Html_Prop_Type::make() | |
| 50 | + 'text' => String_Prop_Type::make() | |
| 58 | 51 | ->default( __( 'Click here', 'elementor' ) ) |
| 59 | - ->description( 'The text displayed on the button.' ) | |
| 60 | - ->alias( 'content', 'label' ), | |
| 52 | + ->description( 'The text displayed on the button.' ), | |
| 61 | 53 | |
| 62 | 54 | 'link' => Link_Prop_Type::make(), |
| 63 | 55 | |
| 64 | - 'tag' => String_Prop_Type::make() | |
| 65 | - ->default( 'button' ) | |
| 66 | - ->description( 'The HTML tag for the button element.' ), | |
| 67 | - | |
| 68 | 56 | 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ), |
| 69 | 57 | ]; |
| 70 | 58 | |
| 71 | 59 | return $props; |
| @@ -74,11 +62,10 @@ | ||
| 74 | 62 | protected function define_atomic_controls(): array { |
| 75 | 63 | return [ |
| 76 | 64 | Section::make() |
| 77 | 65 | ->set_label( __( 'Content', 'elementor' ) ) |
| 78 | - ->set_id( 'content' ) | |
| 79 | 66 | ->set_items( [ |
| 80 | - Inline_Editing_Control::bind_to( 'text' ) | |
| 67 | + Text_Control::bind_to( 'text' ) | |
| 81 | 68 | ->set_placeholder( __( 'Type your button text here', 'elementor' ) ) |
| 82 | 69 | ->set_label( __( 'Button text', 'elementor' ) ), |
| 83 | 70 | ] ), |
| 84 | 71 | Section::make() |
| @@ -149,21 +136,6 @@ | ||
| 149 | 136 | protected function get_templates(): array { |
| 150 | 137 | return [ |
| 151 | 138 | 'elementor/elements/atomic-button' => __DIR__ . '/atomic-button.html.twig', |
| 152 | 139 | ]; |
| 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 | 140 | } |
| 169 | 141 | } |