From 92d90cac26f0f952535e9064dd49dcc25fa6cece Mon Sep 17 00:00:00 2001 From: Stephen Cameron Date: Thu, 1 Oct 2020 15:54:58 +0200 Subject: [PATCH] Fix #3925 @3.5 --- wp-content/mu-plugins/cube/src/Forms/Base.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/wp-content/mu-plugins/cube/src/Forms/Base.php b/wp-content/mu-plugins/cube/src/Forms/Base.php index 5ce0cd1..ed4fb43 100644 --- a/wp-content/mu-plugins/cube/src/Forms/Base.php +++ b/wp-content/mu-plugins/cube/src/Forms/Base.php @@ -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() { -- 2.39.5