PluginProbe
Elementor Website Builder – more than just a page builder / 3.30.1
Elementor Website Builder – more than just a page builder v3.30.1
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 4.1.0-beta2 4.1.0-dev2 All 455 releases
← All changes | modules/atomic-widgets/elements/atomic-paragraph/atomic-paragraph.php +31 -77 4.3.0-beta3 → 3.30.1 View file →
@@ -1,25 +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;
10 -use Elementor\Modules\AtomicWidgets\Elements\Base\Html_Tag_Computer;
9 +use Elementor\Modules\AtomicWidgets\Controls\Types\Textarea_Control;
10 +use Elementor\Modules\AtomicWidgets\Elements\Has_Template;
11 +use Elementor\Modules\AtomicWidgets\Module;
11 12 use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type;
12 -use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type;
13 -use Elementor\Modules\AtomicWidgets\PropTypes\Escaped_Html_Prop_Type;
14 13 use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type;
15 14 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
16 15 use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
17 16 use Elementor\Modules\AtomicWidgets\Styles\Style_Definition;
18 17 use Elementor\Modules\AtomicWidgets\Styles\Style_Variant;
19 -use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control;
20 -use Elementor\Modules\AtomicWidgets\Controls\Types\Inline_Editing_Control;
21 -use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type;
18 +use Elementor\Plugin;
22 19
23 20 if ( ! defined( 'ABSPATH' ) ) {
24 21 exit;
25 22 }
@@ -28,10 +25,8 @@
28 25 use Has_Template;
29 26
30 27 const LINK_BASE_STYLE_KEY = 'link-base';
31 28
32 - public static $widget_description = 'Display a paragraph with customizable tag, styles, and link options.';
33 -
34 29 public static function get_element_type(): string {
35 30 return 'e-paragraph';
36 31 }
37 32
@@ -39,9 +34,9 @@
39 34 return esc_html__( 'Paragraph', 'elementor' );
40 35 }
41 36
42 37 public function get_keywords() {
43 - return [ 'ato', 'atom', 'atoms', 'atomic', 'paragraph', 'text', 'content' ];
38 + return [ 'ato', 'atom', 'atoms', 'atomic' ];
44 39 }
45 40
46 41 public function get_icon() {
47 42 return 'eicon-paragraph';
@@ -46,82 +41,52 @@
46 41 public function get_icon() {
47 42 return 'eicon-paragraph';
48 43 }
49 44
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 -
60 45 protected static function define_props_schema(): array {
61 - return [
46 + $props = [
62 47 'classes' => Classes_Prop_Type::make()
63 48 ->default( [] ),
64 49
65 - 'paragraph' => Escaped_Html_Prop_Type::make()
66 - ->default( __( 'Type your paragraph here', 'elementor' ) )
67 - ->description( 'The text content of the paragraph.' )
68 - ->alias( 'text', 'content' ),
50 + 'paragraph' => String_Prop_Type::make()
51 + ->default( __( 'Type your paragraph here', 'elementor' ) ),
69 52
70 - 'tag' => String_Prop_Type::make()
71 - ->enum( [ 'p', 'span' ] )
72 - ->default( 'p' )
73 - ->description( 'The HTML tag for the paragraph element. One of: p or span. Do not use heading or div tags.' ),
53 + 'link' => Link_Prop_Type::make(),
54 + ];
74 55
75 - '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 + }
76 59
77 - 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ),
78 - ];
60 + return $props;
79 61 }
80 62
81 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 +
82 75 return [
83 76 Section::make()
84 77 ->set_label( __( 'Content', 'elementor' ) )
85 - ->set_id( 'content' )
86 78 ->set_items( [
87 - Inline_Editing_Control::bind_to( 'paragraph' )
88 - ->set_placeholder( __( 'Type your paragraph here', 'elementor' ) )
89 - ->set_label( __( 'Paragraph', 'elementor' ) ),
79 + Textarea_Control::bind_to( 'paragraph' )
80 + ->set_label( __( 'Paragraph', 'elementor' ) )
81 + ->set_placeholder( __( 'Type your paragraph here', 'elementor' ) ),
90 82 ] ),
91 83 Section::make()
92 84 ->set_label( __( 'Settings', 'elementor' ) )
93 - ->set_id( 'settings' )
94 - ->set_items( $this->get_settings_controls() ),
85 + ->set_items( $settings_section_items ),
95 86 ];
96 87 }
97 88
98 - protected function get_settings_controls(): array {
99 - return [
100 - Select_Control::bind_to( 'tag' )
101 - ->set_options([
102 - [
103 - 'value' => 'p',
104 - 'label' => 'p',
105 - ],
106 - [
107 - 'value' => 'span',
108 - 'label' => 'span',
109 - ],
110 - ])
111 - ->set_label( __( 'Tag', 'elementor' ) ),
112 - Link_Control::bind_to( 'link' )
113 - ->set_placeholder( __( 'Type or paste your URL', 'elementor' ) )
114 - ->set_label( __( 'Link', 'elementor' ) )
115 - ->set_meta( [
116 - 'topDivider' => true,
117 - ] ),
118 - Text_Control::bind_to( '_cssid' )
119 - ->set_label( __( 'ID', 'elementor' ) )
120 - ->set_meta( $this->get_css_id_control_meta() ),
121 - ];
122 - }
123 -
124 89 protected function define_base_styles(): array {
125 90 $margin_value = Size_Prop_Type::generate( [
126 91 'unit' => 'px',
127 92 'size' => 0 ,
@@ -145,17 +110,6 @@
145 110 protected function get_templates(): array {
146 111 return [
147 112 'elementor/elements/atomic-paragraph' => __DIR__ . '/atomic-paragraph.html.twig',
148 113 ];
149 - }
150 -
151 - public function render_markdown(): string {
152 - $settings = $this->get_atomic_settings();
153 - $content = $settings['paragraph'] ?? '';
154 -
155 - if ( empty( $content ) ) {
156 - return '';
157 - }
158 -
159 - return \Elementor\Modules\MarkdownRender\Html_To_Markdown::convert( $content );
160 114 }
161 115 }