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() {