PluginProbe
Elementor Website Builder – more than just a page builder / 3.30.0
Elementor Website Builder – more than just a page builder v3.30.0
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 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / modules / atomic-widgets / elements / atomic-paragraph / atomic-paragraph.php

atomic-paragraph.php in Elementor Website Builder – more than just a page builder 3.30.0, at modules/atomic-widgets/elements/atomic-paragraph/atomic-paragraph.php

116 lines 3.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\AtomicWidgets\Elements\Atomic_Paragraph;
4
5 use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control;
6 use Elementor\Modules\AtomicWidgets\Elements\Atomic_Widget_Base;
7 use Elementor\Modules\AtomicWidgets\Controls\Section;
8 use Elementor\Modules\AtomicWidgets\Controls\Types\Link_Control;
9 use Elementor\Modules\AtomicWidgets\Controls\Types\Textarea_Control;
10 use Elementor\Modules\AtomicWidgets\Elements\Has_Template;
11 use Elementor\Modules\AtomicWidgets\Module;
12 use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type;
13 use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type;
14 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
15 use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
16 use Elementor\Modules\AtomicWidgets\Styles\Style_Definition;
17 use Elementor\Modules\AtomicWidgets\Styles\Style_Variant;
18 use Elementor\Plugin;
19
20 if ( ! defined( 'ABSPATH' ) ) {
21 exit;
22 }
23
24 class Atomic_Paragraph extends Atomic_Widget_Base {
25 use Has_Template;
26
27 const LINK_BASE_STYLE_KEY = 'link-base';
28
29 public static function get_element_type(): string {
30 return 'e-paragraph';
31 }
32
33 public function get_title() {
34 return esc_html__( 'Paragraph', 'elementor' );
35 }
36
37 public function get_keywords() {
38 return [ 'ato', 'atom', 'atoms', 'atomic' ];
39 }
40
41 public function get_icon() {
42 return 'eicon-paragraph';
43 }
44
45 protected static function define_props_schema(): array {
46 $props = [
47 'classes' => Classes_Prop_Type::make()
48 ->default( [] ),
49
50 'paragraph' => String_Prop_Type::make()
51 ->default( __( 'Type your paragraph here', 'elementor' ) ),
52
53 'link' => Link_Prop_Type::make(),
54 ];
55
56 if ( Plugin::$instance->experiments->is_feature_active( Module::EXPERIMENT_VERSION_3_30 ) ) {
57 $props['_cssid'] = String_Prop_Type::make();
58 }
59
60 return $props;
61 }
62
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
75 return [
76 Section::make()
77 ->set_label( __( 'Content', 'elementor' ) )
78 ->set_items( [
79 Textarea_Control::bind_to( 'paragraph' )
80 ->set_label( __( 'Paragraph', 'elementor' ) )
81 ->set_placeholder( __( 'Type your paragraph here', 'elementor' ) ),
82 ] ),
83 Section::make()
84 ->set_label( __( 'Settings', 'elementor' ) )
85 ->set_items( $settings_section_items ),
86 ];
87 }
88
89 protected function define_base_styles(): array {
90 $margin_value = Size_Prop_Type::generate( [
91 'unit' => 'px',
92 'size' => 0 ,
93 ] );
94
95 return [
96 'base' => Style_Definition::make()
97 ->add_variant(
98 Style_Variant::make()
99 ->add_prop( 'margin', $margin_value )
100 ),
101 self::LINK_BASE_STYLE_KEY => Style_Definition::make()
102 ->add_variant(
103 Style_Variant::make()
104 ->add_prop( 'all', 'unset' )
105 ->add_prop( 'cursor', 'pointer' )
106 ),
107 ];
108 }
109
110 protected function get_templates(): array {
111 return [
112 'elementor/elements/atomic-paragraph' => __DIR__ . '/atomic-paragraph.html.twig',
113 ];
114 }
115 }
116