function nodeorder_form_alter in Node Order 6
Same name and namespace in other branches
- 5 nodeorder.module \nodeorder_form_alter()
Implementation of hook_form_alter().
File
- ./
nodeorder.module, line 35 - Nodeorder module.
Code
function nodeorder_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'taxonomy_form_vocabulary') {
$is_orderable = $form['module']['#value'] == 'nodeorder';
$form['settings']['orderable'] = array(
'#type' => 'checkbox',
'#title' => t('Orderable'),
'#description' => t('If enabled, nodes may be ordered within this vocabulary.'),
'#weight' => 0.0075,
// Try to have this show up after the 'Required' checkbox
'#default_value' => $is_orderable,
);
// Add a submit handler for saving the orderable settings
$form['#submit'][] = 'nodeorder_taxonomy_form_vocabulary_submit';
/*
* Why not implement hook_taxonomy?
* hook_taxonomy sometimes gets called after editing terms;
* in that case the orderable-value will not be available and thus the
* orderable-setting on the vocabulary will always be disabled
*/
}
}