You are here

function active_tags_form_alter in Active Tags 6.2

Same name and namespace in other branches
  1. 5 active_tags.module \active_tags_form_alter()
  2. 6 active_tags.module \active_tags_form_alter()

Implementation of hook_form_alter.

File

./active_tags.module, line 38
Active Tags widget for free tagging taxonomies

Code

function active_tags_form_alter(&$form, $form_state, $form_id) {
  if ($form_id === 'taxonomy_form_vocabulary') {
    drupal_add_js(drupal_get_path('module', 'active_tags') . '/active_tags_settings.js');
    $form['settings']['tags']['#weight'] = -3;
    $form['settings']['active_tags'] = array(
      '#type' => 'checkbox',
      '#title' => t('Active Tags'),
      '#weight' => -2,
      '#default_value' => isset($form['vid']) ? variable_get('active_tags_' . $form['vid']['#value'], 0) : 0,
      '#description' => t('Swaps this vocabulary widget for an enhanced tag field if browser supports javascript.'),
      '#prefix' => '<div id="active-tags-wrapper">',
      '#suffix' => '</div>',
    );
    $form['#submit'][] = 'active_tags_form_vocabulary_submit';
  }
  if ($form['#id'] === 'node-form' && isset($form['taxonomy']['tags'])) {
    $form['#after_build'][] = 'active_tags_node_form_attach';
  }
}