You are here

function biblio_type_save in Bibliography Module 7.3

Save biblio type.

@todo: When changing the machine name create a batch api that will update the biblio entries to the new bundle machine name.

Parameters

object $biblio_type: The values of a biblio type.

3 calls to biblio_type_save()
biblio_add_publication_types in ./biblio.module
Create new Biblio bundles.
biblio_ui_manage_bundles_manage_submit in modules/biblio_ui/biblio_ui.module
Creating/saving the new biblio type.
MigrateDestinationBiblioType::import in includes/migrate/plugins/destinations/biblio_type.inc
Import a biblio type.

File

./biblio.module, line 392
Maintains bibliographic lists.

Code

function biblio_type_save($biblio_type) {
  if (biblio_types($biblio_type->type)) {
    db_update('biblio_type')
      ->fields(array(
      'name' => $biblio_type->name,
      'description' => $biblio_type->description,
    ))
      ->condition('type', $biblio_type->type)
      ->execute();
  }
  else {
    db_insert('biblio_type')
      ->fields((array) $biblio_type)
      ->execute();

    // Attach the contributors field collection to the new biblio bundle.
    biblio_create_field('contributor_field_collection', 'biblio', $biblio_type->type);
    biblio_create_field('biblio_contributor_role', 'field_collection_item', 'contributor_field_collection');
    biblio_create_field('biblio_contributor', 'field_collection_item', 'contributor_field_collection');
  }
}