PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.0-beta1
Elementor Website Builder – more than just a page builder v4.0.0-beta1
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
elementor / modules / atomic-widgets / elements / atomic-form / form-message / form-message.php

form-message.php in Elementor Website Builder – more than just a page builder 4.0.0-beta1, at modules/atomic-widgets/elements/atomic-form/form-message/form-message.php

100 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Modules\AtomicWidgets\Elements\Atomic_Form\Form_Message;
3
4 use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Element_Base;
5 use Elementor\Modules\AtomicWidgets\Elements\Base\Has_Element_Template;
6 use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type;
7 use Elementor\Modules\AtomicWidgets\PropTypes\Background_Prop_Type;
8 use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type;
9 use Elementor\Modules\AtomicWidgets\PropTypes\Color_Prop_Type;
10 use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type;
11 use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type;
12 use Elementor\Modules\AtomicWidgets\Styles\Style_Definition;
13 use Elementor\Modules\AtomicWidgets\Styles\Style_Variant;
14 use Elementor\Modules\AtomicWidgets\Controls\Section;
15 use Elementor\Modules\AtomicWidgets\Controls\Types\Text_Control;
16
17 if ( ! defined( 'ABSPATH' ) ) {
18 exit;
19 }
20
21 abstract class Form_Message extends Atomic_Element_Base {
22 use Has_Element_Template;
23
24 const BASE_STYLE_KEY = 'base';
25
26 abstract protected static function get_background_color(): string;
27
28 abstract protected static function get_text_color(): string;
29
30 public function __construct( $data = [], $args = null ) {
31 parent::__construct( $data, $args );
32 $this->meta( 'is_container', true );
33 }
34
35 public function get_icon() {
36 return 'eicon-div-block';
37 }
38
39 public function should_show_in_panel() {
40 return false;
41 }
42
43 protected static function define_props_schema(): array {
44 return [
45 'classes' => Classes_Prop_Type::make()
46 ->default( [] ),
47 'attributes' => Attributes_Prop_Type::make(),
48 ];
49 }
50
51 protected function define_atomic_controls(): array {
52 return [
53 Section::make()
54 ->set_label( __( 'Settings', 'elementor' ) )
55 ->set_id( 'settings' )
56 ->set_items( [
57 Text_Control::bind_to( '_cssid' )
58 ->set_label( __( 'ID', 'elementor' ) )
59 ->set_meta( $this->get_css_id_control_meta() ),
60 ] ),
61 ];
62 }
63
64 protected function define_base_styles(): array {
65 return [
66 static::BASE_STYLE_KEY => Style_Definition::make()
67 ->add_variant(
68 Style_Variant::make()
69 ->add_props( [
70 'display' => String_Prop_Type::generate( 'none' ),
71 'background' => Background_Prop_Type::generate( [
72 'color' => Color_Prop_Type::generate( static::get_background_color() ),
73 ] ),
74 'color' => Color_Prop_Type::generate( static::get_text_color() ),
75 'padding' => Size_Prop_Type::generate( [
76 'size' => 12,
77 'unit' => 'px',
78 ] ),
79 'text-align' => String_Prop_Type::generate( 'center' ),
80 'font-size' => Size_Prop_Type::generate( [
81 'size' => 12,
82 'unit' => 'px',
83 ] ),
84 'font-family' => String_Prop_Type::generate( 'Poppins' ),
85 ] )
86 ),
87 ];
88 }
89
90 protected function get_templates(): array {
91 return [
92 'elementor/elements/form-message' => __DIR__ . '/form-message.html.twig',
93 ];
94 }
95
96 protected function build_template_context(): array {
97 return $this->build_base_template_context();
98 }
99 }
100