You are here

function _og_vocab_term_exists_in_vocab in OG Vocabulary 7

Checks if the term already exists in the vocabulary.

Parameters

$name: The term name.

$vid: The vocabulary ID.

Return value

The term ID if found, or FALSE.

1 call to _og_vocab_term_exists_in_vocab()
_og_vocab_autocomplete_tags_validate in ./og_vocab.module

File

./og_vocab.module, line 531
Give each group its own system controlled vocabularies.

Code

function _og_vocab_term_exists_in_vocab($name, $vid) {
  $query = new EntityFieldQuery();
  $result = $query
    ->entityCondition('entity_type', 'taxonomy_term')
    ->propertyCondition('vid', $vid)
    ->propertyCondition('name', $name)
    ->execute();
  return !empty($result['taxonomy_term']) ? reset(array_keys($result['taxonomy_term'])) : FALSE;
}