function _biblio_prepare_submit in Bibliography Module 7.2
Same name and namespace in other branches
- 6.2 biblio.module \_biblio_prepare_submit()
- 6 biblio.module \_biblio_prepare_submit()
- 7 biblio.module \_biblio_prepare_submit()
Prepare a biblio for submit to database. Contains code common to insert and update.
Parameters
object $biblio:
2 calls to _biblio_prepare_submit()
- biblio_save in ./
biblio.module - Save a biblio object to the database
- biblio_update in ./
biblio.module - Implementation of hook_update().
File
- ./
biblio.module, line 1697
Code
function _biblio_prepare_submit(&$biblio) {
module_load_include('inc', 'biblio', 'includes/biblio.util');
$wrapper = biblio_wrapper($biblio);
if (!isset($biblio->publication_type)) {
$biblio->publication_type = 'miscellaneous';
}
$title = $wrapper->biblio_title
->value();
$biblio->biblio_sort_title = biblio_normalize_title($title);
if (!isset($biblio->biblio_year)) {
$wrapper->biblio_year
->set(9999);
}
$wrapper->biblio_year
->set(_biblio_numeric_year($wrapper->biblio_year
->value()));
if (variable_get('biblio_auto_citekey', 1) && empty($biblio->biblio_citekey)) {
$biblio->biblio_citekey = biblio_citekey_generate($biblio);
}
foreach (_biblio_get_formatted_fields() as $field) {
if (isset($biblio->{$field}) && is_array($biblio->{$field})) {
$biblio->biblio_formats[$field] = $biblio->{$field}['format'];
$biblio->{$field} = $biblio->{$field}['value'];
}
}
$wrapper->biblio_coins
->set(biblio_coins($biblio));
}