function nat_settings_form in Node Auto Term [NAT] 6.2
Same name and namespace in other branches
- 5 nat.module \nat_settings_form()
- 6 nat.admin.inc \nat_settings_form()
- 7.2 nat.admin.inc \nat_settings_form()
- 7 nat.admin.inc \nat_settings_form()
Menu callback: NAT module settings form.
1 string reference to 'nat_settings_form'
- nat_menu in ./
nat.module - Implementation of hook_menu().
File
- ./
nat.admin.inc, line 11 - NAT module administrative forms.
Code
function nat_settings_form() {
$types = node_get_types();
$vocabularies = _nat_get_vocabularies();
if (empty($vocabularies)) {
drupal_set_message(t('The NAT module requires at least one vocabulary to be defined.'), 'error');
drupal_goto('admin/content/taxonomy');
}
$nat_config = _nat_variable_get();
foreach ($types as $type => $type_object) {
$collapsed = !isset($nat_config['types'][$type]) || empty($nat_config['types'][$type]);
$form['nat_' . $type] = array(
'#type' => 'fieldset',
'#title' => check_plain($type_object->name),
'#collapsible' => TRUE,
'#collapsed' => $collapsed,
);
$form['nat_' . $type][$type] = array(
'#type' => 'select',
'#title' => t('Vocabularies'),
'#options' => $vocabularies,
'#default_value' => isset($nat_config['types'][$type]) ? $nat_config['types'][$type] : array(),
'#multiple' => TRUE,
'#description' => t('Creating a node of type %type will automatically create a term in any selected vocabularies.', array(
'%type' => $type,
)),
'#parents' => array(
'types',
$type,
),
);
$form['nat_' . $type]['body_' . $type] = array(
'#type' => 'checkbox',
'#title' => t('Associate node body with term description.'),
'#default_value' => isset($nat_config['body'][$type]) ? $nat_config['body'][$type] : 0,
'#parents' => array(
'body',
$type,
),
);
$form['nat_' . $type]['delete_' . $type] = array(
'#type' => 'checkbox',
'#title' => t('Delete associated term if a node is deleted.'),
'#default_value' => isset($nat_config['delete'][$type]) ? $nat_config['delete'][$type] : 0,
'#parents' => array(
'delete',
$type,
),
);
$form['nat_' . $type]['related_' . $type] = array(
'#type' => 'checkbox',
'#title' => t('Allow users to define synonyms and related terms when they create and edit nodes.'),
'#default_value' => isset($nat_config['related'][$type]) ? $nat_config['related'][$type] : 0,
'#parents' => array(
'related',
$type,
),
);
$form['nat_' . $type]['node_links_' . $type] = array(
'#type' => 'checkbox',
'#title' => t('Make NAT terms in %type node views point to the associated node rather than the taxonomy page.', array(
'%type' => $type,
)),
'#default_value' => isset($nat_config['node_links'][$type]) ? $nat_config['node_links'][$type] : 0,
'#parents' => array(
'node_links',
$type,
),
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save configuration'),
);
return $form;
}