You are here

function biblio_install in Bibliography Module 6.2

Same name and namespace in other branches
  1. 5 biblio.install \biblio_install()
  2. 6 biblio.install \biblio_install()
  3. 7.3 biblio.install \biblio_install()
  4. 7 biblio.install \biblio_install()
  5. 7.2 biblio.install \biblio_install()

Implements hook_install().

File

./biblio.install, line 12
Install, update, and uninstall functions for the biblio module.

Code

function biblio_install() {
  $result = array();

  // Create the database tables that will store data for the biblio module.
  $result[] = drupal_install_schema('biblio');

  // There are numerous bibliographic types. Initialize the {biblio_types} table
  // with an initial list of bibliographic types.
  $result[] = _biblio_add_bibliographic_types();

  // Each type of biblio publication (for example, a book) may have one or more
  // fields associated with it, such as title, ISBN number, etc. Hence, set up
  // definition parameters about how a title, ISBN, etc. are defined as a custom
  // biblio field.
  $result[] = _biblio_add_field_definitions();

  // With the types of custom biblio fields now defined, we need to set which
  // custom biblio fields are to be used with each bibliographic type and adjust
  // the field labels as appropriate.
  $result[] = _biblio_types_customize_fields();

  // Drupal hooks are processed by modules as they are set in the system table
  // in order of the module weight.  Those with heavier wights are called later
  // in the sequence.  Increase the weight of this module for a later call.
  $result[] = _biblio_set_module_system_weight();
  if (count($result) == count(array_filter($result))) {
    drupal_set_message(t('The biblio module has successfully added its tables to the database.'));
  }
  else {
    drupal_set_message(t('Drupal encountered some errors while attempting to install the database tables for the biblio module.'), 'error');
  }
}