You are here

function autotag_tag_suggestions in Taxonomy Autotagger 7.3

Same name and namespace in other branches
  1. 8.3 autotag.module \autotag_tag_suggestions()

Callback as defined above in hook_tag_suggestion_info

1 string reference to 'autotag_tag_suggestions'
autotag_tag_suggestion_info in ./autotag.module
Implementation of hook_tag_suggestion_info().

File

./autotag.module, line 32
Implements the API on tag suggestion/autotagging modules as outlined at http://groups.drupal.org/node/100179

Code

function autotag_tag_suggestions($text, $options) {

  // Simply passed the text.  We now need to get the vids that we're interested
  // in (specific for this module).
  $tags = array();
  foreach ($options['autotag_vids'] as $vid) {
    $term_count = db_query("SELECT COUNT(*) FROM {taxonomy_term_data} WHERE vid = ?", array(
      $vid,
    ))
      ->fetchField();
    if ($term_count > 0 && strlen(trim($text))) {
      $tags = array_merge($tags, autotag_search_text($text, $vid, $options['tag_only_with_tips']));
    }
  }
  return $tags;
}