You are here

function nodeorder_form_taxonomy_form_vocabulary_alter in Node Order 7

Implements hook_form_FORM_ID_alter() for taxonomy_form_vocabulary().

File

./nodeorder.module, line 137
Nodeorder module.

Code

function nodeorder_form_taxonomy_form_vocabulary_alter(&$form, $form_state) {
  if (isset($form_state['confirm_delete'])) {
    return;
  }

  // If it's a new term, $form['#vocabulary']->module won't exist.
  $is_orderable = isset($form['#vocabulary']->module) && $form['#vocabulary']->module === 'nodeorder';
  $form['nodeorder'] = array(
    '#type' => 'fieldset',
    '#title' => t('Node Order'),
    '#weight' => 1,
  );
  $form['nodeorder']['orderable'] = array(
    '#type' => 'checkbox',
    '#title' => t('Orderable'),
    '#description' => t('If enabled, nodes may be ordered within this vocabulary.'),
    '#default_value' => $is_orderable,
  );

  // Add a submit handler for saving the orderable settings
  $form['#submit'][] = 'nodeorder_taxonomy_form_vocabulary_submit';
}