From: Stephen Cameron Date: Thu, 1 Oct 2020 13:54:58 +0000 (+0200) Subject: Fix #3925 @3.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=92d90cac26f0f952535e9064dd49dcc25fa6cece;p=ccv-wordpress.git Fix #3925 @3.5 --- 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() {