You are here

function hashtags_form_alter in Hashtags 7.2

Same name and namespace in other branches
  1. 8 hashtags.module \hashtags_form_alter()
  2. 6.2 hashtags.module \hashtags_form_alter()
  3. 6 hashtags.module \hashtags_form_alter()

Implementation of hook_form_alter().

File

./hashtags.module, line 52

Code

function hashtags_form_alter(&$form, $form_state, $form_id) {
  $vid = variable_get('hashtags_vocabulary', '');

  // check only for hashtag content types.
  if (isset($form['type']) && isset($form['#node']) && _hashtags_node_check_node_type($form['#node']) && !variable_get('hashtags_show_taxonomy_field', 1)) {
    $voc = taxonomy_vocabulary_load($vid);
    $hashtags_field_id = "edit-field-" . $voc->machine_name;

    // Hide hashtag textfield from node add/edit page;
    drupal_add_js('(function($){$("div#' . $hashtags_field_id . '").css("display", "none");})(jQuery);', array(
      'type' => 'inline',
      'scope' => 'footer',
    ));
  }
}