PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.0-beta3
Elementor Website Builder – more than just a page builder v4.3.0-beta3
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
← All changes | modules/atomic-widgets/elements/atomic-form/atomic-form.php +19 -17 4.2.0-dev24.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;
@@ -28,8 +29,9 @@
28 29 use Elementor\Modules\AtomicWidgets\Styles\Style_Definition;
29 30 use Elementor\Modules\AtomicWidgets\Styles\Style_Variant;
30 31 use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager;
31 32 use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type;
33 +use Elementor\Plugin;
32 34
33 35 if ( ! defined( 'ABSPATH' ) ) {
34 36 exit; // Exit if accessed directly.
35 37 }
@@ -51,8 +53,9 @@
51 53
52 54 public function __construct( $data = [], $args = null ) {
53 55 parent::__construct( $data, $args );
54 56 $this->meta( 'is_container', true );
57 + $this->meta( 'is_compound', true );
55 58 }
56 59
57 60 public static function get_default_recipient_email(): string {
58 61 return sanitize_email( (string) get_option( 'admin_email', '' ) );
@@ -81,8 +84,12 @@
81 84 public function get_icon() {
82 85 return 'eicon-atomic-form';
83 86 }
84 87
88 + public static function get_computed_html_tag( array $settings ): string {
89 + return Html_Tag_Computer::compute( $settings, 'form' );
90 + }
91 +
85 92 public static function get_base_props_schema(): array {
86 93 return self::define_props_schema();
87 94 }
88 95
@@ -282,12 +289,8 @@
282 289 protected function define_panel_categories(): array {
283 290 return [ 'atomic-form' ];
284 291 }
285 292
286 - protected function define_default_html_tag() {
287 - return 'form';
288 - }
289 -
290 293 protected function define_default_children() {
291 294
292 295 $prefix = 'e-form-';
293 296
@@ -308,12 +311,9 @@
308 311 $children[] = $this->build_checkbox_row( __( 'Checkbox', 'elementor' ), $prefix . 'checkbox' );
309 312
310 313 $children[] = Widget_Builder::make( 'e-form-submit-button' )
311 314 ->settings( [
312 - 'text' => Html_V3_Prop_Type::generate( [
313 - 'content' => String_Prop_Type::generate( __( 'Submit', 'elementor' ) ),
314 - 'children' => [],
315 - ] ),
315 + 'text' => Escaped_Html_Prop_Type::generate( __( 'Submit', 'elementor' ) ),
316 316 ] )
317 317 ->build();
318 318 $children[] = $this->build_status_message(
319 319 __( 'Great! We’ve received your information.', 'elementor' ),
@@ -348,12 +348,9 @@
348 348
349 349 private function build_label( string $text, string $input_id ): array {
350 350 return Widget_Builder::make( 'e-form-label' )
351 351 ->settings( [
352 - 'text' => Html_V3_Prop_Type::generate( [
353 - 'content' => String_Prop_Type::generate( $text ),
354 - 'children' => [],
355 - ] ),
352 + 'text' => Escaped_Html_Prop_Type::generate( $text ),
356 353 'input-id' => String_Prop_Type::generate( $input_id ),
357 354 ] )
358 355 ->build();
359 356 }
@@ -378,12 +375,9 @@
378 375 ->build();
379 376 }
380 377
381 378 private function build_status_message( string $message, string $state, string $title ): array {
382 - $paragraph_value = Html_V3_Prop_Type::generate( [
383 - 'content' => String_Prop_Type::generate( $message ),
384 - 'children' => [],
385 - ] );
379 + $paragraph_value = Escaped_Html_Prop_Type::generate( $message );
386 380
387 381 $element_type = 'success' === $state
388 382 ? Form_Success_Message::get_element_type()
389 383 : Form_Error_Message::get_element_type();
@@ -418,13 +412,21 @@
418 412 $context = $this->build_base_template_context();
419 413
420 414 $context['form_state'] = 'default';
421 415
416 + if ( ! $this->is_webmcp_enabled() ) {
417 + return $context;
418 + }
419 +
422 420 $form_name = (string) ( $this->get_atomic_settings()['form-name'] ?? '' );
423 421 $context['webmcp_tool_name'] = Webmcp_Utils::build_tool_name( $form_name, (string) $this->get_id() );
424 422 $context['webmcp_tool_description'] = Webmcp_Utils::build_tool_description( $form_name );
425 423
426 424 return $context;
425 + }
426 +
427 + private function is_webmcp_enabled(): bool {
428 + return ! Plugin::$instance->editor->is_edit_mode();
427 429 }
428 430
429 431 public static function is_instance_form( $instance ): bool {
430 432 return $instance instanceof Atomic_Form;