← All changes
|
modules/atomic-widgets/elements/atomic-form/atomic-form.php
+10
-17
4.2.2
→
4.3.0-beta3
View file →
| @@ -12,8 +12,9 @@ | ||
| 12 | 12 | use Elementor\Modules\AtomicWidgets\Elements\Atomic_Form\Form_Error_Message\Form_Error_Message; |
| 13 | 13 | use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Element_Base; |
| 14 | 14 | use Elementor\Modules\AtomicWidgets\Elements\Base\Element_Builder; |
| 15 | 15 | use Elementor\Modules\AtomicWidgets\Elements\Base\Has_Element_Template; |
| 16 | +use Elementor\Modules\AtomicWidgets\Elements\Base\Html_Tag_Computer; | |
| 16 | 17 | use Elementor\Modules\AtomicWidgets\Elements\Base\Widget_Builder; |
| 17 | 18 | use Elementor\Modules\AtomicWidgets\PropDependencies\Manager as Dependency_Manager; |
| 18 | 19 | use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type; |
| 19 | 20 | use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type; |
| @@ -21,9 +22,9 @@ | ||
| 21 | 22 | use Elementor\Modules\AtomicWidgets\PropTypes\Key_Value_Prop_Type; |
| 22 | 23 | use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\Boolean_Prop_Type; |
| 23 | 24 | use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\Number_Prop_Type; |
| 24 | 25 | use Elementor\Modules\AtomicWidgets\PropTypes\Size_Prop_Type; |
| 25 | -use Elementor\Modules\AtomicWidgets\PropTypes\Html_V3_Prop_Type; | |
| 26 | +use Elementor\Modules\AtomicWidgets\PropTypes\Escaped_Html_Prop_Type; | |
| 26 | 27 | use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Array_Prop_Type; |
| 27 | 28 | use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\String_Prop_Type; |
| 28 | 29 | use Elementor\Modules\AtomicWidgets\Styles\Style_Definition; |
| 29 | 30 | use Elementor\Modules\AtomicWidgets\Styles\Style_Variant; |
| @@ -52,8 +53,9 @@ | ||
| 52 | 53 | |
| 53 | 54 | public function __construct( $data = [], $args = null ) { |
| 54 | 55 | parent::__construct( $data, $args ); |
| 55 | 56 | $this->meta( 'is_container', true ); |
| 57 | + $this->meta( 'is_compound', true ); | |
| 56 | 58 | } |
| 57 | 59 | |
| 58 | 60 | public static function get_default_recipient_email(): string { |
| 59 | 61 | return sanitize_email( (string) get_option( 'admin_email', '' ) ); |
| @@ -82,8 +84,12 @@ | ||
| 82 | 84 | public function get_icon() { |
| 83 | 85 | return 'eicon-atomic-form'; |
| 84 | 86 | } |
| 85 | 87 | |
| 88 | + public static function get_computed_html_tag( array $settings ): string { | |
| 89 | + return Html_Tag_Computer::compute( $settings, 'form' ); | |
| 90 | + } | |
| 91 | + | |
| 86 | 92 | public static function get_base_props_schema(): array { |
| 87 | 93 | return self::define_props_schema(); |
| 88 | 94 | } |
| 89 | 95 | |
| @@ -283,12 +289,8 @@ | ||
| 283 | 289 | protected function define_panel_categories(): array { |
| 284 | 290 | return [ 'atomic-form' ]; |
| 285 | 291 | } |
| 286 | 292 | |
| 287 | - protected function define_default_html_tag() { | |
| 288 | - return 'form'; | |
| 289 | - } | |
| 290 | - | |
| 291 | 293 | protected function define_default_children() { |
| 292 | 294 | |
| 293 | 295 | $prefix = 'e-form-'; |
| 294 | 296 | |
| @@ -309,12 +311,9 @@ | ||
| 309 | 311 | $children[] = $this->build_checkbox_row( __( 'Checkbox', 'elementor' ), $prefix . 'checkbox' ); |
| 310 | 312 | |
| 311 | 313 | $children[] = Widget_Builder::make( 'e-form-submit-button' ) |
| 312 | 314 | ->settings( [ |
| 313 | - 'text' => Html_V3_Prop_Type::generate( [ | |
| 314 | - 'content' => String_Prop_Type::generate( __( 'Submit', 'elementor' ) ), | |
| 315 | - 'children' => [], | |
| 316 | - ] ), | |
| 315 | + 'text' => Escaped_Html_Prop_Type::generate( __( 'Submit', 'elementor' ) ), | |
| 317 | 316 | ] ) |
| 318 | 317 | ->build(); |
| 319 | 318 | $children[] = $this->build_status_message( |
| 320 | 319 | __( 'Great! We’ve received your information.', 'elementor' ), |
| @@ -349,12 +348,9 @@ | ||
| 349 | 348 | |
| 350 | 349 | private function build_label( string $text, string $input_id ): array { |
| 351 | 350 | return Widget_Builder::make( 'e-form-label' ) |
| 352 | 351 | ->settings( [ |
| 353 | - 'text' => Html_V3_Prop_Type::generate( [ | |
| 354 | - 'content' => String_Prop_Type::generate( $text ), | |
| 355 | - 'children' => [], | |
| 356 | - ] ), | |
| 352 | + 'text' => Escaped_Html_Prop_Type::generate( $text ), | |
| 357 | 353 | 'input-id' => String_Prop_Type::generate( $input_id ), |
| 358 | 354 | ] ) |
| 359 | 355 | ->build(); |
| 360 | 356 | } |
| @@ -379,12 +375,9 @@ | ||
| 379 | 375 | ->build(); |
| 380 | 376 | } |
| 381 | 377 | |
| 382 | 378 | private function build_status_message( string $message, string $state, string $title ): array { |
| 383 | - $paragraph_value = Html_V3_Prop_Type::generate( [ | |
| 384 | - 'content' => String_Prop_Type::generate( $message ), | |
| 385 | - 'children' => [], | |
| 386 | - ] ); | |
| 379 | + $paragraph_value = Escaped_Html_Prop_Type::generate( $message ); | |
| 387 | 380 | |
| 388 | 381 | $element_type = 'success' === $state |
| 389 | 382 | ? Form_Success_Message::get_element_type() |
| 390 | 383 | : Form_Error_Message::get_element_type(); |