function revision_all_settings_form in Revision All 7.2
Same name and namespace in other branches
- 8 revision_all.module \revision_all_settings_form()
- 6 revision_all.module \revision_all_settings_form()
- 7 revision_all.module \revision_all_settings_form()
Defines the settings form.
1 string reference to 'revision_all_settings_form'
- revision_all_menu in ./
revision_all.module - Implements hook_menu().
File
- ./
revision_all.module, line 27 - 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($form, &$form_state) {
$content_types = node_type_get_names();
$revision_settings = variable_get('revision_all', array());
$revisioned_types = array();
foreach ($content_types as $key => $type) {
if (revision_all_type_is_revisioned($key) !== FALSE) {
$revisioned_types[] = $type;
}
}
$form['revision_all'] = array(
'#tree' => TRUE,
);
$form['revision_all']['revision_all_types'] = array(
'#type' => 'checkbox',
'#title' => t('Revision All'),
'#description' => t('Enable revisioning for all content types.'),
'#default_value' => sizeof($revisioned_types) == sizeof($content_types) && $revision_settings['revision_all_types'],
);
$form['revision_all']['revision_types'] = array(
'#type' => 'fieldset',
'#title' => t('Revisioning By Content Type'),
'#description' => t('Select the content types you would like revisioned.
<em>Note</em>: Selecting "Revision All" above overrides these settings.'),
'#states' => array(
'visible' => array(
':input[name="revision_all[revision_all_types]"]' => array(
'checked' => FALSE,
),
),
),
);
$form['revision_all']['revision_types']['types'] = array(
'#type' => 'checkboxes',
'#options' => drupal_map_assoc($content_types),
'#default_value' => $revisioned_types,
'#states' => array(
'visible' => array(
// action to take.
':input[name="revision_all_types"]' => array(
'checked' => FALSE,
),
),
),
);
$form['revision_all']['enable_future'] = array(
'#title' => t('Enable for all Future Content Types'),
'#description' => t('Automatically checks the "Create new revision" checkbox
when creating new content types. <em>Note</em>: Selecting "Revision All"
will automatically enable revisioning for future content types as well.'),
'#type' => 'checkbox',
'#default_value' => $revision_settings['enable_future'],
'#states' => array(
'visible' => array(
':input[name="revision_all[revision_all_types]"]' => array(
'checked' => FALSE,
),
),
),
);
$form['revision_all']['prevent_type_override'] = array(
'#title' => t('Prevent Content Type Revisioning Overrides'),
'#description' => t('Disables the "Create new revision" checkbox from the
content types edit form. Forces users to create new revisions for that
content type unless the type is disabled in <em>this</em> interface.'),
'#type' => 'checkbox',
'#default_value' => $revision_settings['prevent_type_override'],
);
$form['revision_all']['prevent_node_override'] = array(
'#title' => t('Prevent Node Revisioning Overrides'),
'#description' => t('Disables the "Create new revision" checkbox in the
node add/edit form. Forces the user to create a new revision if the
content type is set to be revisioning.'),
'#type' => 'checkbox',
'#default_value' => $revision_settings['prevent_node_override'],
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
return $form;
}