You are here

function community_tags_node_form_community_tags_node_tag_mgmt_form_alter in Community Tags 6.2

Implementation of hook_form_FORM_ID_alter() for community tag managment form.

File

community_tags_node/community_tags_node.module, line 85
community_tags_node.module

Code

function community_tags_node_form_community_tags_node_tag_mgmt_form_alter(&$form, &$form_state) {
  if (isset($form_state['values']['operation'])) {

    // add for multiple operations
    $form['#submit'][] = 'community_tags_node_node_tag_mgmt_confirm_submit';
  }
  else {
    $node = $form['#node'];
    if ($form['tags']['#options'] && is_array($form['tags']['#options'])) {
      $tag_tids = array_keys($form['tags']['#options']);
      $node_term_tids = array_keys($node->taxonomy);
      $tag_only_tids = array_diff($tag_tids, $node_term_tids);
      foreach ($tag_only_tids as $tid) {
        $form['operations'][$tid]['#operations'][] = array(
          'title' => t('Promote'),
          'href' => 'community-tags/tagmgmtops/promote/' . $node->nid . '/' . $tid,
          'query' => drupal_get_destination(),
        );
        $form['operations'][$tid]['#value'] = theme_links($form['operations'][$tid]['#operations']);
      }
      $form['options']['operation']['#options']['promote'] = t('Promote');
    }
  }
}