You are here

function active_tags_popular_form_alter in Active Tags 6

Same name and namespace in other branches
  1. 6.2 active_tags_popular.module \active_tags_popular_form_alter()

Implementation of hook_form_alter().

File

./active_tags_popular.module, line 69
Adds popular terms to Active Tags widget

Code

function active_tags_popular_form_alter(&$form, $form_state, $form_id) {
  if ($form_id === 'taxonomy_form_vocabulary') {
    $form['settings']['active_tags_popular'] = array(
      '#type' => 'checkbox',
      '#title' => t('Active Tags Helper - Popular'),
      '#weight' => 11,
      '#default_value' => isset($form['vid']) ? variable_get('active_tags_popular_' . $form['vid']['#value'], 0) : 0,
      '#description' => t('Adds additional helpers to the active tags widget to assist in adding popular tags to posts'),
    );
    $form['settings']['active_tags_popular_no'] = array(
      '#type' => 'textfield',
      '#title' => t('Number of popular tags to show'),
      '#weight' => 12,
      '#size' => 20,
      '#default_value' => isset($form['vid']) ? variable_get('active_tags_popular_no_' . $form['vid']['#value'], 10) : 10,
    );
    $form['#submit'][] = 'active_tags_popular_form_vocabulary_submit';
  }
  if ($form['#id'] === 'node-form' && isset($form['taxonomy']['tags'])) {
    $form['#after_build'][] = 'active_tags_popular_node_form_attach';
  }
}