]> _ Git - ccv-wordpress.git/commitdiff
Fix #3925 @3.5
authorStephen Cameron <stephen@cubedesigners.com>
Thu, 1 Oct 2020 13:54:58 +0000 (15:54 +0200)
committerStephen Cameron <stephen@cubedesigners.com>
Thu, 1 Oct 2020 13:54:58 +0000 (15:54 +0200)
wp-content/mu-plugins/cube/src/Forms/Base.php

index 5ce0cd18692b2d466a57960fc90dda9a662dffba..ed4fb4397c11f3be470cbc5507343b11968607e0 100644 (file)
@@ -40,14 +40,15 @@ class Base
 
     public function init() {
 
-        $this->register_fields();
-
-        // Only register the scripts and instantiate HTML builder if this is a non-AJAX request
-        if (!wp_doing_ajax()) {
-            $this->register_scripts();
+        // Prepare the form
+        // NOTE: previously register_scripts() and $this->builder weren't set for AJAX requests
+        // because they shouldn't be needed when processing the form. However, this causes exceptions
+        // with Elementor because it needs to save a rendered version of the content (for WP compatibility)
+        // Ref: https://team.cubedesigners.com/redmine/issues/3925
 
-            $this->builder = new FormBuilder($this->get_fields());
-        }
+        $this->register_fields();
+        $this->register_scripts();
+        $this->builder = new FormBuilder($this->get_fields());
     }
 
     public function register_scripts() {