← All changes
|
modules/atomic-widgets/elements/atomic-paragraph/atomic-paragraph.php
+17
-8
4.2.0-dev2
→
4.3.0-beta3
View file →
| @@ -6,11 +6,12 @@ | ||
| 6 | 6 | use Elementor\Modules\AtomicWidgets\Controls\Section; |
| 7 | 7 | use Elementor\Modules\AtomicWidgets\Controls\Types\Link_Control; |
| 8 | 8 | use Elementor\Modules\AtomicWidgets\Controls\Types\Select_Control; |
| 9 | 9 | use Elementor\Modules\AtomicWidgets\Elements\Base\Has_Template; |
| 10 | +use Elementor\Modules\AtomicWidgets\Elements\Base\Html_Tag_Computer; | |
| 10 | 11 | use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type; |
| 11 | 12 | use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type; |
| 12 | -use Elementor\Modules\AtomicWidgets\PropTypes\Html_V3_Prop_Type; | |
| 13 | +use Elementor\Modules\AtomicWidgets\PropTypes\Escaped_Html_Prop_Type; | |
| 13 | 14 | use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type; |
| 14 | 15 | use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type; |
| 15 | 16 | use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type; |
| 16 | 17 | use Elementor\Modules\AtomicWidgets\Styles\Style_Definition; |
| @@ -38,9 +39,9 @@ | ||
| 38 | 39 | return esc_html__( 'Paragraph', 'elementor' ); |
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | public function get_keywords() { |
| 42 | - return [ 'ato', 'atom', 'atoms', 'atomic' ]; | |
| 43 | + return [ 'ato', 'atom', 'atoms', 'atomic', 'paragraph', 'text', 'content' ]; | |
| 43 | 44 | } |
| 44 | 45 | |
| 45 | 46 | public function get_icon() { |
| 46 | 47 | return 'eicon-paragraph'; |
| @@ -45,24 +46,32 @@ | ||
| 45 | 46 | public function get_icon() { |
| 46 | 47 | return 'eicon-paragraph'; |
| 47 | 48 | } |
| 48 | 49 | |
| 50 | + public static function html_tag_follows_link(): bool { | |
| 51 | + return false; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public static function get_computed_html_tag( array $settings ): string { | |
| 55 | + return Html_Tag_Computer::compute( $settings, 'p', [ | |
| 56 | + Html_Tag_Computer::FOLLOW_LINK_OPTION => static::html_tag_follows_link(), | |
| 57 | + ] ); | |
| 58 | + } | |
| 59 | + | |
| 49 | 60 | protected static function define_props_schema(): array { |
| 50 | 61 | return [ |
| 51 | 62 | 'classes' => Classes_Prop_Type::make() |
| 52 | 63 | ->default( [] ), |
| 53 | 64 | |
| 54 | - 'paragraph' => Html_V3_Prop_Type::make() | |
| 55 | - ->default( [ | |
| 56 | - 'content' => String_Prop_Type::generate( __( 'Type your paragraph here', 'elementor' ) ), | |
| 57 | - 'children' => [], | |
| 58 | - ] ) | |
| 65 | + 'paragraph' => Escaped_Html_Prop_Type::make() | |
| 66 | + ->default( __( 'Type your paragraph here', 'elementor' ) ) | |
| 59 | 67 | ->description( 'The text content of the paragraph.' ) |
| 60 | 68 | ->alias( 'text', 'content' ), |
| 61 | 69 | |
| 62 | 70 | 'tag' => String_Prop_Type::make() |
| 63 | 71 | ->enum( [ 'p', 'span' ] ) |
| 64 | - ->default( 'p' ), | |
| 72 | + ->default( 'p' ) | |
| 73 | + ->description( 'The HTML tag for the paragraph element. One of: p or span. Do not use heading or div tags.' ), | |
| 65 | 74 | |
| 66 | 75 | 'link' => Link_Prop_Type::make(), |
| 67 | 76 | |
| 68 | 77 | 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ), |