| 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 |
use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type; |
| 17 |
|
| 18 |
if ( ! defined( 'ABSPATH' ) ) { |
| 19 |
exit; |
| 20 |
} |
| 21 |
|
| 22 |
abstract class Form_Message extends Atomic_Element_Base { |
| 23 |
use Has_Element_Template; |
| 24 |
|
| 25 |
const BASE_STYLE_KEY = 'base'; |
| 26 |
|
| 27 |
abstract protected static function get_background_color(): string; |
| 28 |
|
| 29 |
abstract protected static function get_text_color(): string; |
| 30 |
|
| 31 |
public function __construct( $data = [], $args = null ) { |
| 32 |
parent::__construct( $data, $args ); |
| 33 |
$this->meta( 'is_container', true ); |
| 34 |
} |
| 35 |
|
| 36 |
public function get_icon() { |
| 37 |
return 'eicon-div-block'; |
| 38 |
} |
| 39 |
|
| 40 |
public function should_show_in_panel() { |
| 41 |
return false; |
| 42 |
} |
| 43 |
|
| 44 |
protected static function define_props_schema(): array { |
| 45 |
return [ |
| 46 |
'classes' => Classes_Prop_Type::make() |
| 47 |
->default( [] ), |
| 48 |
'attributes' => Attributes_Prop_Type::make()->meta( Overridable_Prop_Type::ignore() ), |
| 49 |
]; |
| 50 |
} |
| 51 |
|
| 52 |
protected function define_atomic_controls(): array { |
| 53 |
return [ |
| 54 |
Section::make() |
| 55 |
->set_label( __( 'Settings', 'elementor' ) ) |
| 56 |
->set_id( 'settings' ) |
| 57 |
->set_items( [ |
| 58 |
Text_Control::bind_to( '_cssid' ) |
| 59 |
->set_label( __( 'ID', 'elementor' ) ) |
| 60 |
->set_meta( $this->get_css_id_control_meta() ), |
| 61 |
] ), |
| 62 |
]; |
| 63 |
} |
| 64 |
|
| 65 |
protected function define_base_styles(): array { |
| 66 |
return [ |
| 67 |
static::BASE_STYLE_KEY => Style_Definition::make() |
| 68 |
->add_variant( |
| 69 |
Style_Variant::make() |
| 70 |
->add_props( [ |
| 71 |
'display' => String_Prop_Type::generate( 'none' ), |
| 72 |
'background' => Background_Prop_Type::generate( [ |
| 73 |
'color' => Color_Prop_Type::generate( static::get_background_color() ), |
| 74 |
] ), |
| 75 |
'color' => Color_Prop_Type::generate( static::get_text_color() ), |
| 76 |
'padding' => Size_Prop_Type::generate( [ |
| 77 |
'size' => 12, |
| 78 |
'unit' => 'px', |
| 79 |
] ), |
| 80 |
'text-align' => String_Prop_Type::generate( 'center' ), |
| 81 |
'font-size' => Size_Prop_Type::generate( [ |
| 82 |
'size' => 12, |
| 83 |
'unit' => 'px', |
| 84 |
] ), |
| 85 |
'font-family' => String_Prop_Type::generate( 'Poppins' ), |
| 86 |
] ) |
| 87 |
), |
| 88 |
]; |
| 89 |
} |
| 90 |
|
| 91 |
protected function get_templates(): array { |
| 92 |
return [ |
| 93 |
'elementor/elements/form-message' => __DIR__ . '/form-message.html.twig', |
| 94 |
]; |
| 95 |
} |
| 96 |
|
| 97 |
protected function build_template_context(): array { |
| 98 |
return $this->build_base_template_context(); |
| 99 |
} |
| 100 |
} |
| 101 |
|