Import new forms
This commit is contained in:
@@ -82,12 +82,34 @@ function wiaas_create_organization_roles_capabilities() {
|
||||
function update_delivery_forms() {
|
||||
|
||||
$forms = GFAPI::get_forms();
|
||||
|
||||
foreach ($forms as $form) {
|
||||
GFAPI::delete_form($form['id']);
|
||||
RGFormsModel::update_form_active($form['id'], false);
|
||||
}
|
||||
|
||||
GFExport::import_file(dirname( __FILE__ ) . "/data/delivery-forms/delivery-action-forms.json");
|
||||
$created_forms = array();
|
||||
|
||||
GFExport::import_file(dirname( __FILE__ ) . "/data/delivery-forms/delivery-process-sample-form.json");
|
||||
$actions_forms_json = file_get_contents( dirname( __FILE__ ) . '/data/delivery-forms/delivery-action-forms.json' );
|
||||
|
||||
$action_forms_meta = json_decode( $actions_forms_json, true );
|
||||
|
||||
foreach ($action_forms_meta as $action_form_meta) {
|
||||
|
||||
$form_id = GFAPI::add_form($action_form_meta);
|
||||
$created_forms[] = GFAPI::get_form($form_id);
|
||||
}
|
||||
|
||||
|
||||
$sample_form_json = file_get_contents( dirname( __FILE__ ) . '/data/delivery-forms/delivery-process-sample-form.json' );
|
||||
|
||||
$sample_form = json_decode( $sample_form_json, true );
|
||||
|
||||
$sample_form = $sample_form[0];
|
||||
|
||||
$sample_form_id = GFAPI::add_form($sample_form);
|
||||
|
||||
RGFormsModel::update_form_active($sample_form_id, false);
|
||||
|
||||
$created_forms[] = GFAPI::get_form($sample_form_id);
|
||||
|
||||
do_action('gform_forms_post_import', $created_forms);
|
||||
}
|
||||
Reference in New Issue
Block a user