PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.0-dev1
Elementor Website Builder – more than just a page builder v3.28.0-dev1
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.28.0-dev1, at modules/atomic-widgets/elements/atomic-paragraph/atomic-paragraph.php

91 lines 2.6 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\Color_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 use Elementor\Modules\WpRest\Classes\WP_Post;
18
19 if ( ! defined( 'ABSPATH' ) ) {
20 exit;
21 }
22
23 class Atomic_Paragraph extends Atomic_Widget_Base {
24 use Has_Template;
25
26 public static function get_element_type(): string {
27 return 'a-paragraph';
28 }
29
30 public function get_title() {
31 return esc_html__( 'Atomic Paragraph', 'elementor' );
32 }
33
34 public function get_icon() {
35 return 'eicon-paragraph';
36 }
37
38 protected static function define_props_schema(): array {
39 return [
40 'classes' => Classes_Prop_Type::make()
41 ->default( [] ),
42
43 'paragraph' => String_Prop_Type::make()
44 ->default( __( 'Type your paragraph here', 'elementor' ) ),
45
46 'link' => Link_Prop_Type::make(),
47 ];
48 }
49
50 protected function define_atomic_controls(): array {
51 return [
52 Section::make()
53 ->set_label( __( 'Content', 'elementor' ) )
54 ->set_items( [
55 Textarea_Control::bind_to( 'paragraph' )
56 ->set_label( __( 'Paragraph', 'elementor' ) )
57 ->set_placeholder( __( 'Type your paragraph here', 'elementor' ) ),
58
59 Link_Control::bind_to( 'link' ),
60 ] ),
61 ];
62 }
63
64 protected function define_base_styles(): array {
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',
70 ] );
71 $line_height_value = String_Prop_Type::generate( '1.5' );
72
73 return [
74 'base' => Style_Definition::make()
75 ->add_variant(
76 Style_Variant::make()
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 )
81 ),
82 ];
83 }
84
85 protected function get_templates(): array {
86 return [
87 'elementor/elements/atomic-paragraph' => __DIR__ . '/atomic-paragraph.html.twig',
88 ];
89 }
90 }
91