You are here

function nodewords_form_taxonomy_form_term_alter in Nodewords: D6 Meta Tags 6

Implements hook_form_FORM_ID_alter().

File

./nodewords.module, line 204
Implement an API that other modules can use to implement meta tags.

Code

function nodewords_form_taxonomy_form_term_alter(&$form, &$form_state) {
  $bool = isset($form['tid']['#value']) && !isset($form_state['confirm_delete']) && !isset($form_state['confirm_parents']);
  if ($bool) {
    $id = $form['tid']['#value'];
    if (!empty($form_state['values']['nodewords'])) {
      $tags = $form_state['values']['nodewords'];
    }
    elseif (isset($id) && is_numeric($id)) {
      $tags = nodewords_load_tags(NODEWORDS_TYPE_TERM, $id);
    }
    else {
      $tags = array();
    }
    $form['nodewords'] = nodewords_form(NODEWORDS_TYPE_TERM, $tags);

    // Ensure the submit & delete buttons are at the bottom. Hopefully.
    $form['submit']['#weight'] = 1000;
    $form['delete']['#weight'] = 1001;
  }
}