← All changes
|
modules/atomic-widgets/elements/atomic-heading/atomic-heading.php
+16
-8
4.2.0
→
4.3.0-beta3
View file →
| @@ -7,11 +7,12 @@ | ||
| 7 | 7 | use Elementor\Modules\AtomicWidgets\Controls\Types\Select_Control; |
| 8 | 8 | use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control; |
| 9 | 9 | use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Widget_Base; |
| 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\Attributes_Prop_Type; |
| 12 | 13 | use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type; |
| 13 | -use Elementor\Modules\AtomicWidgets\PropTypes\Html_V3_Prop_Type; | |
| 14 | +use Elementor\Modules\AtomicWidgets\PropTypes\Escaped_Html_Prop_Type; | |
| 14 | 15 | use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type; |
| 15 | 16 | use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type; |
| 16 | 17 | use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type; |
| 17 | 18 | use Elementor\Modules\AtomicWidgets\Styles\Style_Definition; |
| @@ -37,9 +38,9 @@ | ||
| 37 | 38 | return esc_html__( 'Heading', 'elementor' ); |
| 38 | 39 | } |
| 39 | 40 | |
| 40 | 41 | public function get_keywords() { |
| 41 | - return [ 'ato', 'atom', 'atoms', 'atomic' ]; | |
| 42 | + return [ 'ato', 'atom', 'atoms', 'atomic', 'heading', 'title', 'text', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ]; | |
| 42 | 43 | } |
| 43 | 44 | |
| 44 | 45 | public function get_icon() { |
| 45 | 46 | return 'eicon-e-heading'; |
| @@ -44,8 +45,18 @@ | ||
| 44 | 45 | public function get_icon() { |
| 45 | 46 | return 'eicon-e-heading'; |
| 46 | 47 | } |
| 47 | 48 | |
| 49 | + public static function html_tag_follows_link(): bool { | |
| 50 | + return false; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public static function get_computed_html_tag( array $settings ): string { | |
| 54 | + return Html_Tag_Computer::compute( $settings, 'h2', [ | |
| 55 | + Html_Tag_Computer::FOLLOW_LINK_OPTION => static::html_tag_follows_link(), | |
| 56 | + ] ); | |
| 57 | + } | |
| 58 | + | |
| 48 | 59 | protected static function define_props_schema(): array { |
| 49 | 60 | return [ |
| 50 | 61 | 'classes' => Classes_Prop_Type::make() |
| 51 | 62 | ->default( [] ), |
| @@ -52,15 +63,12 @@ | ||
| 52 | 63 | |
| 53 | 64 | 'tag' => String_Prop_Type::make() |
| 54 | 65 | ->enum( [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ] ) |
| 55 | 66 | ->default( 'h2' ) |
| 56 | - ->description( 'The HTML tag for the heading element. Could be h1, h2, up to h6' ), | |
| 67 | + ->description( 'The HTML tag for the heading element. One of: h1, h2, h3, h4, h5, or h6. Do not use p, span, or div.' ), | |
| 57 | 68 | |
| 58 | - 'title' => Html_V3_Prop_Type::make() | |
| 59 | - ->default( [ | |
| 60 | - 'content' => String_Prop_Type::generate( __( 'This is a title', 'elementor' ) ), | |
| 61 | - 'children' => [], | |
| 62 | - ] ) | |
| 69 | + 'title' => Escaped_Html_Prop_Type::make() | |
| 70 | + ->default( __( 'This is a title', 'elementor' ) ) | |
| 63 | 71 | ->description( 'The text content of the heading.' ) |
| 64 | 72 | ->alias( 'text', 'content', 'heading' ), |
| 65 | 73 | |
| 66 | 74 | 'link' => Link_Prop_Type::make(), |