You are here

function biblio_citekey_generate in Bibliography Module 5

Same name and namespace in other branches
  1. 6.2 biblio.module \biblio_citekey_generate()
  2. 6 biblio.module \biblio_citekey_generate()
  3. 7 biblio.module \biblio_citekey_generate()
  4. 7.2 biblio.module \biblio_citekey_generate()
2 calls to biblio_citekey_generate()
biblio_insert in ./biblio.module
Implementation of hook_insert().
biblio_update in ./biblio.module
Implementation of hook_update().

File

./biblio.module, line 1864

Code

function biblio_citekey_generate($node) {
  $prefix = variable_get('biblio_citekey_prefix', '');
  $primary_field = variable_get('biblio_citekey_field1', 'nid');
  $secondary_field = variable_get('biblio_citekey_field2', 'nid');
  $citekey = !empty($node->{$primary_field}) ? $node->{$primary_field} : (!empty($node->{$secondary_field}) ? $node->{$secondary_field} : $node->nid);
  return check_plain($prefix . $citekey);
}