function rules_admin_import_workflow_ng in Rules 6
Tries to import workflow-ng rules.
Return value
TRUE, only if workflow-ng rules are detected.
1 call to rules_admin_import_workflow_ng()
- rules_admin_form_import_submit in rules_admin/
rules_admin.export.inc
File
- rules_admin/
rules_admin.export.inc, line 89
Code
function rules_admin_import_workflow_ng($import) {
foreach ($import as $name => $cfg) {
if (count(element_children($cfg)) == count($cfg)) {
// This is no workflow-ng rule, so exit
return FALSE;
}
rules_include('rules');
// Load the install and form include files, as there modules
// may provide upgrade information.
module_load_all_includes('install');
rules_include('rules_forms');
$rule = rules_import_workflow_ng_rule($name, $cfg);
if ($rule) {
// Handle rule format upgrades as the workflow-ng import just returns rules of the initial format
$rule = rules_rule_format_upgrade($rule);
rules_item_save('rules', $name, $rule);
drupal_set_message(t('Successfully imported the workflow-ng rule %label.', array(
'%label' => $rule['#label'],
)));
}
else {
drupal_set_message(t('Failed importing the workflow-ng rule %label.', array(
'%label' => $rule['#label'],
)), 'error');
}
}
rules_clear_cache();
return TRUE;
}