function biblio_get_keyword_by_name in Bibliography Module 6.2
Same name and namespace in other branches
- 6 biblio.keywords.inc \biblio_get_keyword_by_name()
- 7 includes/biblio.keywords.inc \biblio_get_keyword_by_name()
- 7.2 includes/biblio.keywords.inc \biblio_get_keyword_by_name()
Retrieves a keyword object by keyword name.
Parameters
string $name: String of the name to use for an exact lowercase match.
Return value
object|false The keyword object if name was found; otherwise FALSE.
2 calls to biblio_get_keyword_by_name()
File
- includes/
biblio.keywords.inc, line 18 - Keywords related functions for Drupal biblio module.
Code
function biblio_get_keyword_by_name($name) {
static $keywords = array();
if (!($kid = array_search($name, $keywords))) {
$term = db_fetch_object(db_query("SELECT * FROM {biblio_keyword_data} k WHERE LOWER(k.word) = LOWER('%s')", trim($name)));
if ($term) {
$keywords[$term->kid] = $term;
return $keywords[$term->kid];
}
else {
return FALSE;
}
}
return $keywords[$kid];
}