PluginProbe
Elementor Website Builder – more than just a page builder / 3.30.0-beta1
Elementor Website Builder – more than just a page builder v3.30.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
← All changes | modules/atomic-widgets/elements/atomic-paragraph/atomic-paragraph.php +30 -65 4.1.4 → 3.30.0-beta1 View file →
@@ -1,24 +1,22 @@
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\Controls\Types\Text_Control;
6 +use Elementor\Modules\AtomicWidgets\Elements\Atomic_Widget_Base;
6 7 use Elementor\Modules\AtomicWidgets\Controls\Section;
7 8 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;
9 +use Elementor\Modules\AtomicWidgets\Controls\Types\Textarea_Control;
10 +use Elementor\Modules\AtomicWidgets\Elements\Has_Template;
11 +use Elementor\Modules\AtomicWidgets\Module;
10 12 use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type;
11 -use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type;
12 -use Elementor\Modules\AtomicWidgets\PropTypes\Html_V3_Prop_Type;
13 13 use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type;
14 14 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
15 15 use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
16 16 use Elementor\Modules\AtomicWidgets\Styles\Style_Definition;
17 17 use Elementor\Modules\AtomicWidgets\Styles\Style_Variant;
18 -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;
18 +use Elementor\Plugin;
21 19
22 20 if ( ! defined( 'ABSPATH' ) ) {
23 21 exit;
24 22 }
@@ -27,10 +25,8 @@
27 25 use Has_Template;
28 26
29 27 const LINK_BASE_STYLE_KEY = 'link-base';
30 28
31 - public static $widget_description = 'Display a paragraph with customizable tag, styles, and link options.';
32 -
33 29 public static function get_element_type(): string {
34 30 return 'e-paragraph';
35 31 }
36 32
@@ -46,71 +42,51 @@
46 42 return 'eicon-paragraph';
47 43 }
48 44
49 45 protected static function define_props_schema(): array {
50 - return [
46 + $props = [
51 47 'classes' => Classes_Prop_Type::make()
52 48 ->default( [] ),
53 49
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.' ),
50 + 'paragraph' => String_Prop_Type::make()
51 + ->default( __( 'Type your paragraph here', 'elementor' ) ),
60 52
61 - 'tag' => String_Prop_Type::make()
62 - ->enum( [ 'p', 'span' ] )
63 - ->default( 'p' ),
53 + 'link' => Link_Prop_Type::make(),
54 + ];
64 55
65 - 'link' => Link_Prop_Type::make(),
56 + if ( Plugin::$instance->experiments->is_feature_active( Module::EXPERIMENT_VERSION_3_30 ) ) {
57 + $props['_cssid'] = String_Prop_Type::make();
58 + }
66 59
67 - 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ),
68 - ];
60 + return $props;
69 61 }
70 62
71 63 protected function define_atomic_controls(): array {
64 + $settings_section_items = [
65 + Link_Control::bind_to( 'link' ),
66 + ];
67 +
68 + if ( Plugin::$instance->experiments->is_feature_active( Module::EXPERIMENT_VERSION_3_30 ) ) {
69 + $settings_section_items[] = Text_Control::bind_to( '_cssid' )->set_label( __( 'ID', 'elementor' ) )->set_meta( [
70 + 'layout' => 'two-columns',
71 + 'topDivider' => true,
72 + ] );
73 + }
74 +
72 75 return [
73 76 Section::make()
74 77 ->set_label( __( 'Content', 'elementor' ) )
75 78 ->set_items( [
76 - Inline_Editing_Control::bind_to( 'paragraph' )
77 - ->set_placeholder( __( 'Type your paragraph here', 'elementor' ) )
78 - ->set_label( __( 'Paragraph', 'elementor' ) ),
79 + Textarea_Control::bind_to( 'paragraph' )
80 + ->set_label( __( 'Paragraph', 'elementor' ) )
81 + ->set_placeholder( __( 'Type your paragraph here', 'elementor' ) ),
79 82 ] ),
80 83 Section::make()
81 84 ->set_label( __( 'Settings', 'elementor' ) )
82 - ->set_id( 'settings' )
83 - ->set_items( $this->get_settings_controls() ),
85 + ->set_items( $settings_section_items ),
84 86 ];
85 87 }
86 88
87 - protected function get_settings_controls(): array {
88 - 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 - 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 - ] ),
107 - Text_Control::bind_to( '_cssid' )
108 - ->set_label( __( 'ID', 'elementor' ) )
109 - ->set_meta( $this->get_css_id_control_meta() ),
110 - ];
111 - }
112 -
113 89 protected function define_base_styles(): array {
114 90 $margin_value = Size_Prop_Type::generate( [
115 91 'unit' => 'px',
116 92 'size' => 0 ,
@@ -134,17 +110,6 @@
134 110 protected function get_templates(): array {
135 111 return [
136 112 'elementor/elements/atomic-paragraph' => __DIR__ . '/atomic-paragraph.html.twig',
137 113 ];
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 114 }
150 115 }