PluginProbe
Elementor Website Builder – more than just a page builder / 3.31.2
Elementor Website Builder – more than just a page builder v3.31.2
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 4.1.0-beta1 4.1.0-dev1 All 452 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.31.2, at modules/atomic-widgets/elements/atomic-paragraph/atomic-paragraph.php

105 lines 2.7 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\Elements\Atomic_Widget_Base;
6 use Elementor\Modules\AtomicWidgets\Controls\Section;
7 use Elementor\Modules\AtomicWidgets\Controls\Types\Link_Control;
8 use Elementor\Modules\AtomicWidgets\Controls\Types\Textarea_Control;
9 use Elementor\Modules\AtomicWidgets\Elements\Has_Template;
10 use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type;
11 use Elementor\Modules\AtomicWidgets\PropTypes\Key_Value_Array_Prop_Type;
12 use Elementor\Modules\AtomicWidgets\PropTypes\Link_Prop_Type;
13 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
14 use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
15 use Elementor\Modules\AtomicWidgets\Styles\Style_Definition;
16 use Elementor\Modules\AtomicWidgets\Styles\Style_Variant;
17
18 if ( ! defined( 'ABSPATH' ) ) {
19 exit;
20 }
21
22 class Atomic_Paragraph extends Atomic_Widget_Base {
23 use Has_Template;
24
25 const LINK_BASE_STYLE_KEY = 'link-base';
26
27 public static function get_element_type(): string {
28 return 'e-paragraph';
29 }
30
31 public function get_title() {
32 return esc_html__( 'Paragraph', 'elementor' );
33 }
34
35 public function get_keywords() {
36 return [ 'ato', 'atom', 'atoms', 'atomic' ];
37 }
38
39 public function get_icon() {
40 return 'eicon-paragraph';
41 }
42
43 protected static function define_props_schema(): array {
44 $props = [
45 'classes' => Classes_Prop_Type::make()
46 ->default( [] ),
47
48 'paragraph' => String_Prop_Type::make()
49 ->default( __( 'Type your paragraph here', 'elementor' ) ),
50
51 'link' => Link_Prop_Type::make(),
52
53 'attributes' => Key_Value_Array_Prop_Type::make(),
54 ];
55
56 return $props;
57 }
58
59 protected function define_atomic_controls(): array {
60 return [
61 Section::make()
62 ->set_label( __( 'Content', 'elementor' ) )
63 ->set_items( [
64 Textarea_Control::bind_to( 'paragraph' )
65 ->set_label( __( 'Paragraph', 'elementor' ) )
66 ->set_placeholder( __( 'Type your paragraph here', 'elementor' ) ),
67 ] ),
68 ];
69 }
70
71 protected function get_settings_controls(): array {
72 return [
73 Link_Control::bind_to( 'link' )
74 ->set_label( __( 'Link', 'elementor' ) ),
75 ];
76 }
77
78 protected function define_base_styles(): array {
79 $margin_value = Size_Prop_Type::generate( [
80 'unit' => 'px',
81 'size' => 0 ,
82 ] );
83
84 return [
85 'base' => Style_Definition::make()
86 ->add_variant(
87 Style_Variant::make()
88 ->add_prop( 'margin', $margin_value )
89 ),
90 self::LINK_BASE_STYLE_KEY => Style_Definition::make()
91 ->add_variant(
92 Style_Variant::make()
93 ->add_prop( 'all', 'unset' )
94 ->add_prop( 'cursor', 'pointer' )
95 ),
96 ];
97 }
98
99 protected function get_templates(): array {
100 return [
101 'elementor/elements/atomic-paragraph' => __DIR__ . '/atomic-paragraph.html.twig',
102 ];
103 }
104 }
105