function revision_all_settings_form_submit in Revision All 8
Same name and namespace in other branches
- 6 revision_all.module \revision_all_settings_form_submit()
- 7.2 revision_all.module \revision_all_settings_form_submit()
- 7 revision_all.module \revision_all_settings_form_submit()
Processes the settings form.
Parameters
$form: The form being processed.
$form_state: The state of the form upon submission.
File
- ./
revision_all.module, line 103 - Permits configuring content revision settings from a central location. Also makes alterations to existing forms based on user specified settings.
Code
function revision_all_settings_form_submit(&$form, &$form_state) {
$content_types = node_type_get_names();
$revision_all = $form_state['values']['revision-all']['revision-all'];
$revision_types = $form_state['values']['revision-all']['revision-types'];
unset($form_state['values']['revision-all']['revision-types']);
variable_set('revision_all', $form_state['values']['revision-all']);
while ($type = current($content_types)) {
$key = key($content_types);
$settings_key = "node_options_{$key}";
$type_settings = variable_get($settings_key, array());
$should_revision = $revision_all || $revision_types[$type];
$currently_revision = array_search('revision', $type_settings);
if ($should_revision && $currently_revision === FALSE) {
$type_settings[] = 'revision';
}
elseif ($currently_revision !== FALSE && !$should_revision) {
unset($type_settings[$currently_revision]);
}
variable_set($settings_key, $type_settings);
next($content_types);
}
drupal_set_message(t('Revisioning Set'));
}