← All changes
|
modules/atomic-widgets/elements/atomic-form/atomic-form.php
+9
-0
4.2.0-beta2
→
4.2.1
View file →
| @@ -28,8 +28,9 @@ | ||
| 28 | 28 | use Elementor\Modules\AtomicWidgets\Styles\Style_Definition; |
| 29 | 29 | use Elementor\Modules\AtomicWidgets\Styles\Style_Variant; |
| 30 | 30 | use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager; |
| 31 | 31 | use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type; |
| 32 | +use Elementor\Plugin; | |
| 32 | 33 | |
| 33 | 34 | if ( ! defined( 'ABSPATH' ) ) { |
| 34 | 35 | exit; // Exit if accessed directly. |
| 35 | 36 | } |
| @@ -418,13 +419,21 @@ | ||
| 418 | 419 | $context = $this->build_base_template_context(); |
| 419 | 420 | |
| 420 | 421 | $context['form_state'] = 'default'; |
| 421 | 422 | |
| 423 | + if ( ! $this->is_webmcp_enabled() ) { | |
| 424 | + return $context; | |
| 425 | + } | |
| 426 | + | |
| 422 | 427 | $form_name = (string) ( $this->get_atomic_settings()['form-name'] ?? '' ); |
| 423 | 428 | $context['webmcp_tool_name'] = Webmcp_Utils::build_tool_name( $form_name, (string) $this->get_id() ); |
| 424 | 429 | $context['webmcp_tool_description'] = Webmcp_Utils::build_tool_description( $form_name ); |
| 425 | 430 | |
| 426 | 431 | return $context; |
| 432 | + } | |
| 433 | + | |
| 434 | + private function is_webmcp_enabled(): bool { | |
| 435 | + return ! Plugin::$instance->editor->is_edit_mode(); | |
| 427 | 436 | } |
| 428 | 437 | |
| 429 | 438 | public static function is_instance_form( $instance ): bool { |
| 430 | 439 | return $instance instanceof Atomic_Form; |