function biblio_get_contributor_by_name in Bibliography Module 7.2
Same name and namespace in other branches
- 6.2 includes/biblio.contributors.inc \biblio_get_contributor_by_name()
- 6 biblio.contributors.inc \biblio_get_contributor_by_name()
- 7 includes/biblio.contributors.inc \biblio_get_contributor_by_name()
2 calls to biblio_get_contributor_by_name()
- biblio_create_contributor_refs in ./
biblio.module - Creates contributor reference fields based on user-entered contributor names and categories. Also creates Contributor entities for those contributors that don't already exist.
- biblio_create_imported_contributors in includes/
biblio.import.export.inc
File
- ./
biblio.module, line 3079
Code
function biblio_get_contributor_by_name($name) {
$contributors =& drupal_static(__FUNCTION__);
if (isset($contributors[$name])) {
return $contributors[$name];
}
// This is a temporary contributor entity only used to get the field values
// and MD5
$contributor = biblio_contributor_create($name);
$result = db_select('biblio_contributor', 'c')
->fields('c', array(
'cid',
'md5',
))
->condition('md5', $contributor->md5)
->execute()
->fetchObject();
if (isset($result->cid)) {
// only need first result
$contributors[$name] = biblio_contributor_load($result->cid);
return $contributors[$name];
}
else {
return FALSE;
}
}