Posted by erantone on September 24, 2009 at 10:04am
| Project: | Bibliography Module |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
If you want to use Authors as part of the citekey automatic generation (with Year of publication and node id), you need the following quick dirty hack in the following function from file biblio.module.
The biblio_authors field is actually the (new?) biblio_contributors field and it is not consistent in the whole code/module.
function biblio_citekey_generate($node) {
$php = variable_get('biblio_citekey_phpcode', '');
if (empty($php)) {
$prefix = variable_get('biblio_citekey_prefix', '');
$primary_field = variable_get('biblio_citekey_field1', 'nid');
$secondary_field = variable_get('biblio_citekey_field2', 'nid');
if ($primary_field == 'biblio_authors') { // hack added
$citekey = $node->biblio_contributors[1][0]['lastname'] . $node-> $secondary_field . '-' . $node->nid;
return $prefix . $citekey;
}
$citekey = (!empty($node-> $primary_field)) ? $node-> $primary_field : (!empty($node-> $secondary_field)) ? $node-> $secondary_field : $node->nid;
// is the above line really correct?
return $prefix . $citekey;
}
else {
ob_start();
$return = eval($php);
ob_end_clean();
return check_plain(strip_tags((string)$return));
}
}