You are here

function fontyourface_save_tag in @font-your-face 7

Same name and namespace in other branches
  1. 6.2 fontyourface.module \fontyourface_save_tag()
  2. 7.2 fontyourface.module \fontyourface_save_tag()

Adds tag if it doesn't already exist.

1 call to fontyourface_save_tag()
fontyourface_add_tags_to_font in ./fontyourface.module
Adds tags to font.

File

./fontyourface.module, line 1023

Code

function fontyourface_save_tag(&$tag) {
  $exists = db_query("SELECT tid FROM {fontyourface_tag} WHERE name = :name", array(
    ':name' => $tag->name,
  ))
    ->fetchObject();
  if ($exists) {
    $tag->tid = $exists->tid;
  }
  else {
    drupal_write_record('fontyourface_tag', $tag);
  }

  // else
}