← All changes
|
modules/atomic-widgets/elements/atomic-button/atomic-button.php
+8
-27
4.3.0-beta3
→
4.0.9
View file →
| @@ -7,13 +7,12 @@ | ||
| 7 | 7 | use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Widget_Base; |
| 8 | 8 | use Elementor\Modules\AtomicWidgets\Controls\Section; |
| 9 | 9 | use Elementor\Modules\AtomicWidgets\Controls\Types\Link_Control; |
| 10 | 10 | use Elementor\Modules\AtomicWidgets\Elements\Base\Has_Template; |
| 11 | -use Elementor\Modules\AtomicWidgets\Elements\Base\Html_Tag_Computer; | |
| 12 | 11 | use Elementor\Modules\AtomicWidgets\PropTypes\Background_Prop_Type; |
| 13 | 12 | use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type; |
| 14 | 13 | use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type; |
| 15 | -use Elementor\Modules\AtomicWidgets\PropTypes\Escaped_Html_Prop_Type; | |
| 14 | +use Elementor\Modules\AtomicWidgets\PropTypes\Html_V3_Prop_Type; | |
| 16 | 15 | use Elementor\Modules\AtomicWidgets\PropTypes\Color_Prop_Type; |
| 17 | 16 | use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type; |
| 18 | 17 | use Elementor\Modules\AtomicWidgets\PropTypes\Dimensions_Prop_Type; |
| 19 | 18 | use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type; |
| @@ -37,9 +36,9 @@ | ||
| 37 | 36 | return esc_html__( 'Button', 'elementor' ); |
| 38 | 37 | } |
| 39 | 38 | |
| 40 | 39 | public function get_keywords() { |
| 41 | - return [ 'ato', 'atom', 'atoms', 'atomic', 'button', 'cta', 'link', 'click' ]; | |
| 40 | + return [ 'ato', 'atom', 'atoms', 'atomic' ]; | |
| 42 | 41 | } |
| 43 | 42 | |
| 44 | 43 | public function get_icon() { |
| 45 | 44 | return 'eicon-e-button'; |
| @@ -44,21 +43,19 @@ | ||
| 44 | 43 | public function get_icon() { |
| 45 | 44 | return 'eicon-e-button'; |
| 46 | 45 | } |
| 47 | 46 | |
| 48 | - public static function get_computed_html_tag( array $settings ): string { | |
| 49 | - return Html_Tag_Computer::compute( $settings, 'button' ); | |
| 50 | - } | |
| 51 | - | |
| 52 | 47 | protected static function define_props_schema(): array { |
| 53 | 48 | $props = [ |
| 54 | 49 | 'classes' => Classes_Prop_Type::make() |
| 55 | 50 | ->default( [] ), |
| 56 | 51 | |
| 57 | - 'text' => Escaped_Html_Prop_Type::make() | |
| 58 | - ->default( __( 'Click here', 'elementor' ) ) | |
| 59 | - ->description( 'The text displayed on the button.' ) | |
| 60 | - ->alias( 'content', 'label' ), | |
| 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.' ), | |
| 61 | 58 | |
| 62 | 59 | 'link' => Link_Prop_Type::make(), |
| 63 | 60 | |
| 64 | 61 | 'tag' => String_Prop_Type::make() |
| @@ -74,9 +71,8 @@ | ||
| 74 | 71 | protected function define_atomic_controls(): array { |
| 75 | 72 | return [ |
| 76 | 73 | Section::make() |
| 77 | 74 | ->set_label( __( 'Content', 'elementor' ) ) |
| 78 | - ->set_id( 'content' ) | |
| 79 | 75 | ->set_items( [ |
| 80 | 76 | Inline_Editing_Control::bind_to( 'text' ) |
| 81 | 77 | ->set_placeholder( __( 'Type your button text here', 'elementor' ) ) |
| 82 | 78 | ->set_label( __( 'Button text', 'elementor' ) ), |
| @@ -149,21 +145,6 @@ | ||
| 149 | 145 | protected function get_templates(): array { |
| 150 | 146 | return [ |
| 151 | 147 | 'elementor/elements/atomic-button' => __DIR__ . '/atomic-button.html.twig', |
| 152 | 148 | ]; |
| 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 | 149 | } |
| 169 | 150 | } |