Import new forms
This commit is contained in:
@@ -23,7 +23,7 @@ class Wiaas_DB_Update {
|
||||
'20181019064450' => 'wiaas_db_update_add_bundle_properties_ui_field',
|
||||
'20191020014650' => 'wiaas_create_organization_roles_capabilities',
|
||||
'20191030162450' => 'wiaas_db_update_update_supplier_order_capabilities',
|
||||
'20191031162450' => 'update_delivery_forms'
|
||||
'20191031162850' => 'update_delivery_forms'
|
||||
);
|
||||
|
||||
public static function execute() {
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -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