Commit 32b08033 authored by Kevin Stover's avatar Kevin Stover

Fixing a bug related to using the new blank form template.

parent 0f9acf9a
Pipeline #606 passed with stage
in 1 minute and 25 seconds
This diff is collapsed.
This diff is collapsed.
......@@ -43,7 +43,7 @@ define( [], function() {
extraData: { template: this.model.get( 'id' ) },
onCompleteCallback: function( response ) {
// Bail if we don't return a form ID.
if ( 'undefined' == response.form_id ) return false;
if ( 'undefined' == typeof response.form_id ) return false;
window.location.href = nfAdmin.builderURL + response.form_id;
}
......
......@@ -13,7 +13,7 @@ class NF_AJAX_REST_NewFormTemplates extends NF_AJAX_REST_Controller
$templates = Ninja_Forms()->config( 'NewFormTemplates' );
usort( $templates, array( $this, 'cmp' ) );
array_unshift( $templates, array(
'id' => 'formtemplate-new',
'id' => 'new',
'title' => __( 'Blank Form', 'ninja-forms' ),
'template-desc' => __( 'The blank form allows you to create any type of form using our drag & drop builder.', 'ninja-forms' ),
'type' => 'default'
......
......@@ -16,11 +16,21 @@ class NF_Admin_Processes_ImportFormTemplate extends NF_Admin_Processes_ImportFor
// If we haven't been passed a template as extraData, then bail.
if ( ! isset ( $_POST[ 'extraData' ][ 'template' ] ) || empty ( $_POST[ 'extraData' ][ 'template' ] ) ) {
$this->cleanup();
$this->batch_complete();
}
$template_file_name = $_POST[ 'extraData' ][ 'template' ];
/**
* If our template_file_name is set to 'new', then respond with 'new' as our form id.
*
* This will redirect to the builder with a new form.
*/
if ( 'new' == $template_file_name ) {
$this->form[ 'ID' ] = 'new';
$this->batch_complete();
}
// Grab the data from the appropriate file location.
$registered_templates = Ninja_Forms::config( 'NewFormTemplates' );
......
{"settings":{"objectType":"Form Setting","editActive":"1","title":"Blank Form","created_at":"2018-10-16 14:11:12","wrapper_class":"","element_class":"","key":"","add_submit":"1","currency":"","unique_field_error":"A form with this value has already been submitted.","not_logged_in_msg":"","sub_limit_msg":"The form has reached its submission limit.","calculations":[],"formContentData":[],"drawerDisabled":""},"fields":[],"actions":[]}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment