PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.0-dev2
Elementor Website Builder – more than just a page builder v3.28.0-dev2
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 4.0.8 All 454 releases
← All changes | modules/atomic-widgets/elements/atomic-paragraph/atomic-paragraph.php +23 -85 4.2.0-beta1 → 3.28.0-dev2 View file →
@@ -1,24 +1,21 @@
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 -use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type;
12 -use Elementor\Modules\AtomicWidgets\PropTypes\Html_V3_Prop_Type;
11 +use Elementor\Modules\AtomicWidgets\PropTypes\Color_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;
17 16 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;
17 +use Elementor\Modules\WpRest\Classes\WP_Post;
21 18
22 19 if ( ! defined( 'ABSPATH' ) ) {
23 20 exit;
24 21 }
@@ -25,24 +22,16 @@
25 22
26 23 class Atomic_Paragraph extends Atomic_Widget_Base {
27 24 use Has_Template;
28 25
29 - const LINK_BASE_STYLE_KEY = 'link-base';
30 -
31 - public static $widget_description = 'Display a paragraph with customizable tag, styles, and link options.';
32 -
33 26 public static function get_element_type(): string {
34 - return 'e-paragraph';
27 + return 'a-paragraph';
35 28 }
36 29
37 30 public function get_title() {
38 - return esc_html__( 'Paragraph', 'elementor' );
31 + return esc_html__( 'Atomic Paragraph', 'elementor' );
39 32 }
40 33
41 - public function get_keywords() {
42 - return [ 'ato', 'atom', 'atoms', 'atomic' ];
43 - }
44 -
45 34 public function get_icon() {
46 35 return 'eicon-paragraph';
47 36 }
48 37
@@ -50,23 +39,12 @@
50 39 return [
51 40 'classes' => Classes_Prop_Type::make()
52 41 ->default( [] ),
53 42
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.' )
60 - ->alias( 'text', 'content' ),
43 + 'paragraph' => String_Prop_Type::make()
44 + ->default( __( 'Type your paragraph here', 'elementor' ) ),
61 45
62 - 'tag' => String_Prop_Type::make()
63 - ->enum( [ 'p', 'span' ] )
64 - ->default( 'p' ),
65 -
66 46 'link' => Link_Prop_Type::make(),
67 -
68 - 'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ),
69 47 ];
70 48 }
71 49
72 50 protected function define_atomic_controls(): array {
@@ -72,65 +50,36 @@
72 50 protected function define_atomic_controls(): array {
73 51 return [
74 52 Section::make()
75 53 ->set_label( __( 'Content', 'elementor' ) )
76 - ->set_id( 'content' )
77 54 ->set_items( [
78 - Inline_Editing_Control::bind_to( 'paragraph' )
79 - ->set_placeholder( __( 'Type your paragraph here', 'elementor' ) )
80 - ->set_label( __( 'Paragraph', 'elementor' ) ),
81 - ] ),
82 - Section::make()
83 - ->set_label( __( 'Settings', 'elementor' ) )
84 - ->set_id( 'settings' )
85 - ->set_items( $this->get_settings_controls() ),
86 - ];
87 - }
55 + Textarea_Control::bind_to( 'paragraph' )
56 + ->set_label( __( 'Paragraph', 'elementor' ) )
57 + ->set_placeholder( __( 'Type your paragraph here', 'elementor' ) ),
88 58
89 - protected function get_settings_controls(): array {
90 - return [
91 - Select_Control::bind_to( 'tag' )
92 - ->set_options([
93 - [
94 - 'value' => 'p',
95 - 'label' => 'p',
96 - ],
97 - [
98 - 'value' => 'span',
99 - 'label' => 'span',
100 - ],
101 - ])
102 - ->set_label( __( 'Tag', 'elementor' ) ),
103 - Link_Control::bind_to( 'link' )
104 - ->set_placeholder( __( 'Type or paste your URL', 'elementor' ) )
105 - ->set_label( __( 'Link', 'elementor' ) )
106 - ->set_meta( [
107 - 'topDivider' => true,
59 + Link_Control::bind_to( 'link' ),
108 60 ] ),
109 - Text_Control::bind_to( '_cssid' )
110 - ->set_label( __( 'ID', 'elementor' ) )
111 - ->set_meta( $this->get_css_id_control_meta() ),
112 61 ];
113 62 }
114 63
115 64 protected function define_base_styles(): array {
116 - $margin_value = Size_Prop_Type::generate( [
117 - 'unit' => 'px',
118 - 'size' => 0 ,
65 + $color_value = Color_Prop_Type::generate( 'black' );
66 + $font_family_value = String_Prop_Type::generate( 'Poppins' );
67 + $font_size_value = Size_Prop_Type::generate( [
68 + 'size' => 1.2,
69 + 'unit' => 'rem',
119 70 ] );
71 + $line_height_value = String_Prop_Type::generate( '1.5' );
120 72
121 73 return [
122 74 'base' => Style_Definition::make()
123 75 ->add_variant(
124 76 Style_Variant::make()
125 - ->add_prop( 'margin', $margin_value )
77 + ->add_prop( 'color', $color_value )
78 + ->add_prop( 'font-family', $font_family_value )
79 + ->add_prop( 'font-size', $font_size_value )
80 + ->add_prop( 'line-height', $line_height_value )
126 81 ),
127 - self::LINK_BASE_STYLE_KEY => Style_Definition::make()
128 - ->add_variant(
129 - Style_Variant::make()
130 - ->add_prop( 'all', 'unset' )
131 - ->add_prop( 'cursor', 'pointer' )
132 - ),
133 82 ];
134 83 }
135 84
136 85 protected function get_templates(): array {
@@ -136,17 +85,6 @@
136 85 protected function get_templates(): array {
137 86 return [
138 87 'elementor/elements/atomic-paragraph' => __DIR__ . '/atomic-paragraph.html.twig',
139 88 ];
140 - }
141 -
142 - public function render_markdown(): string {
143 - $settings = $this->get_atomic_settings();
144 - $content = $settings['paragraph'] ?? '';
145 -
146 - if ( empty( $content ) ) {
147 - return '';
148 - }
149 -
150 - return \Elementor\Modules\MarkdownRender\Html_To_Markdown::convert( $content );
151 89 }
152 90 }