function fontyourface_save_tag in @font-your-face 7.2
Same name and namespace in other branches
- 6.2 fontyourface.module \fontyourface_save_tag()
- 7 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 505
Code
function fontyourface_save_tag(&$tag) {
$exists = db_query("SELECT tid FROM {fontyourface_tag} WHERE name = :name", array(
':name' => $tag->name,
))
->fetchObject();
if ($exists) {
// Check that existing tag is lowercase
if (!ctype_lower($tag->name)) {
$tag->name = drupal_strtolower($tag->name);
}
$tag->tid = $exists->tid;
}
else {
$tag->name = drupal_strtolower($tag->name);
drupal_write_record('fontyourface_tag', $tag);
}
// else
}