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