function msnf_save_step in Multistep Nodeform 6
Same name and namespace in other branches
- 7 includes/msnf.steps.inc \msnf_save_step()
3 calls to msnf_save_step()
- msnf_step_edit_form_submit in includes/
msnf.admin.inc - Submit handler for msnf_step_edit_form().
- msnf_step_features_rebuild in includes/
msnf.features.inc - Implementation of hook_features_rebuild().
- msnf_step_overview_form_submit in includes/
msnf.admin.inc - Submit handler for msnf_step_overview_form().
File
- includes/
msnf.steps.inc, line 143
Code
function msnf_save_step($type_name, $step) {
$steps = msnf_steps($type_name);
// Allow other modules to intervene when the step is saved.
foreach (module_implements('msnf_save_step') as $module) {
$function = $module . '_msnf_save_step';
$function($step);
}
// Update string translations.
_msnf_i18nstrings_step_update($step);
$result = SAVED_NEW;
if (!isset($steps[$step['step_name']])) {
// Accept step name from programmed submissions if valid.
db_query("INSERT INTO {msnf_step} (step_type, type_name, step_name, label, settings, weight)" . " VALUES ('%s', '%s', '%s', '%s', '%s', %d)", $step['step_type'], $type_name, $step['step_name'], $step['label'], serialize($step['settings']), $step['weight']);
cache_clear_all('msnf_step_data:', 'cache', TRUE);
}
else {
db_query("UPDATE {msnf_step} SET step_type = '%s', label = '%s', settings = '%s', weight = %d " . "WHERE type_name = '%s' AND step_name = '%s'", $step['step_type'], $step['label'], serialize($step['settings']), $step['weight'], $type_name, $step['step_name']);
cache_clear_all('msnf_step_data:', 'cache', TRUE);
$result = SAVED_UPDATED;
}
// Update field and group mapping.
foreach (array(
'fields',
'groups',
) as $item_type) {
if (isset($step[$item_type])) {
foreach ($step[$item_type] as $item_name => $item) {
$values = array(
'type_name' => $type_name,
'step' => $step['step_name'],
"field_name" => $item_name,
'weight' => $item['weight'],
);
msnf_step_update_fields($values);
}
}
}
return $result;
}