← All changes
|
modules/atomic-widgets/elements/atomic-paragraph/atomic-paragraph.php
+11
-49
4.1.0
→
3.32.2
View file →
| @@ -1,16 +1,15 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Elementor\Modules\AtomicWidgets\Elements\Atomic_Paragraph; |
| 4 | 4 | |
| 5 | -use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Widget_Base; | |
| 5 | +use Elementor\Modules\AtomicWidgets\Elements\Atomic_Widget_Base; | |
| 6 | 6 | use Elementor\Modules\AtomicWidgets\Controls\Section; |
| 7 | 7 | use Elementor\Modules\AtomicWidgets\Controls\Types\Link_Control; |
| 8 | -use Elementor\Modules\AtomicWidgets\Controls\Types\Select_Control; | |
| 9 | -use Elementor\Modules\AtomicWidgets\Elements\Base\Has_Template; | |
| 8 | +use Elementor\Modules\AtomicWidgets\Controls\Types\Textarea_Control; | |
| 9 | +use Elementor\Modules\AtomicWidgets\Elements\Has_Template; | |
| 10 | 10 | use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type; |
| 11 | 11 | use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type; |
| 12 | -use Elementor\Modules\AtomicWidgets\PropTypes\Html_V3_Prop_Type; | |
| 13 | 12 | use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type; |
| 14 | 13 | use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type; |
| 15 | 14 | use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type; |
| 16 | 15 | use Elementor\Modules\AtomicWidgets\Styles\Style_Definition; |
| @@ -15,10 +14,8 @@ | ||
| 15 | 14 | use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type; |
| 16 | 15 | use Elementor\Modules\AtomicWidgets\Styles\Style_Definition; |
| 17 | 16 | use Elementor\Modules\AtomicWidgets\Styles\Style_Variant; |
| 18 | 17 | use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control; |
| 19 | -use Elementor\Modules\AtomicWidgets\Controls\Types\Inline_Editing_Control; | |
| 20 | -use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type; | |
| 21 | 18 | |
| 22 | 19 | if ( ! defined( 'ABSPATH' ) ) { |
| 23 | 20 | exit; |
| 24 | 21 | } |
| @@ -27,10 +24,8 @@ | ||
| 27 | 24 | use Has_Template; |
| 28 | 25 | |
| 29 | 26 | const LINK_BASE_STYLE_KEY = 'link-base'; |
| 30 | 27 | |
| 31 | - public static $widget_description = 'Display a paragraph with customizable tag, styles, and link options.'; | |
| 32 | - | |
| 33 | 28 | public static function get_element_type(): string { |
| 34 | 29 | return 'e-paragraph'; |
| 35 | 30 | } |
| 36 | 31 | |
| @@ -46,27 +41,21 @@ | ||
| 46 | 41 | return 'eicon-paragraph'; |
| 47 | 42 | } |
| 48 | 43 | |
| 49 | 44 | protected static function define_props_schema(): array { |
| 50 | - return [ | |
| 45 | + $props = [ | |
| 51 | 46 | 'classes' => Classes_Prop_Type::make() |
| 52 | 47 | ->default( [] ), |
| 53 | 48 | |
| 54 | - 'paragraph' => Html_V3_Prop_Type::make() | |
| 55 | - ->default( [ | |
| 56 | - 'content' => String_Prop_Type::generate( __( 'Type your paragraph here', 'elementor' ) ), | |
| 57 | - 'children' => [], | |
| 58 | - ] ) | |
| 59 | - ->description( 'The text content of the paragraph.' ), | |
| 49 | + 'paragraph' => String_Prop_Type::make() | |
| 50 | + ->default( __( 'Type your paragraph here', 'elementor' ) ), | |
| 60 | 51 | |
| 61 | - 'tag' => String_Prop_Type::make() | |
| 62 | - ->enum( [ 'p', 'span' ] ) | |
| 63 | - ->default( 'p' ), | |
| 64 | - | |
| 65 | 52 | 'link' => Link_Prop_Type::make(), |
| 66 | 53 | |
| 67 | - 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ), | |
| 54 | + 'attributes' => Attributes_Prop_Type::make(), | |
| 68 | 55 | ]; |
| 56 | + | |
| 57 | + return $props; | |
| 69 | 58 | } |
| 70 | 59 | |
| 71 | 60 | protected function define_atomic_controls(): array { |
| 72 | 61 | return [ |
| @@ -72,9 +61,9 @@ | ||
| 72 | 61 | return [ |
| 73 | 62 | Section::make() |
| 74 | 63 | ->set_label( __( 'Content', 'elementor' ) ) |
| 75 | 64 | ->set_items( [ |
| 76 | - Inline_Editing_Control::bind_to( 'paragraph' ) | |
| 65 | + Textarea_Control::bind_to( 'paragraph' ) | |
| 77 | 66 | ->set_placeholder( __( 'Type your paragraph here', 'elementor' ) ) |
| 78 | 67 | ->set_label( __( 'Paragraph', 'elementor' ) ), |
| 79 | 68 | ] ), |
| 80 | 69 | Section::make() |
| @@ -85,26 +74,10 @@ | ||
| 85 | 74 | } |
| 86 | 75 | |
| 87 | 76 | protected function get_settings_controls(): array { |
| 88 | 77 | return [ |
| 89 | - Select_Control::bind_to( 'tag' ) | |
| 90 | - ->set_options([ | |
| 91 | - [ | |
| 92 | - 'value' => 'p', | |
| 93 | - 'label' => 'p', | |
| 94 | - ], | |
| 95 | - [ | |
| 96 | - 'value' => 'span', | |
| 97 | - 'label' => 'span', | |
| 98 | - ], | |
| 99 | - ]) | |
| 100 | - ->set_label( __( 'Tag', 'elementor' ) ), | |
| 101 | 78 | Link_Control::bind_to( 'link' ) |
| 102 | - ->set_placeholder( __( 'Type or paste your URL', 'elementor' ) ) | |
| 103 | - ->set_label( __( 'Link', 'elementor' ) ) | |
| 104 | - ->set_meta( [ | |
| 105 | - 'topDivider' => true, | |
| 106 | - ] ), | |
| 79 | + ->set_label( __( 'Link', 'elementor' ) ), | |
| 107 | 80 | Text_Control::bind_to( '_cssid' ) |
| 108 | 81 | ->set_label( __( 'ID', 'elementor' ) ) |
| 109 | 82 | ->set_meta( $this->get_css_id_control_meta() ), |
| 110 | 83 | ]; |
| @@ -134,17 +107,6 @@ | ||
| 134 | 107 | protected function get_templates(): array { |
| 135 | 108 | return [ |
| 136 | 109 | 'elementor/elements/atomic-paragraph' => __DIR__ . '/atomic-paragraph.html.twig', |
| 137 | 110 | ]; |
| 138 | - } | |
| 139 | - | |
| 140 | - public function render_markdown(): string { | |
| 141 | - $settings = $this->get_atomic_settings(); | |
| 142 | - $content = $settings['paragraph'] ?? ''; | |
| 143 | - | |
| 144 | - if ( empty( $content ) ) { | |
| 145 | - return ''; | |
| 146 | - } | |
| 147 | - | |
| 148 | - return \Elementor\Modules\MarkdownRender\Html_To_Markdown::convert( $content ); | |
| 149 | 111 | } |
| 150 | 112 | } |