You are here

function biblio_install in Bibliography Module 7

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

File

./biblio.install, line 10

Code

function biblio_install() {
  $t = get_t();

  // Define the node type.
  $biblio = array(
    'type' => 'biblio',
    'name' => $t('Biblio'),
    'base' => 'biblio',
    'description' => $t('Use Biblio for scholarly content, such as journal papers and books.'),
    'body_label' => $t('Full text'),
  );

  // Complete the node type definition by setting any defaults not explicitly
  // declared above.
  // http://api.drupal.org/api/function/node_type_set_defaults/7
  $content_type = node_type_set_defaults($biblio);
  node_add_body_field($content_type);

  // Save the content type.
  node_type_save($content_type);
  drupal_set_time_limit(300);
  $result[] = _add_db_field_data();
  $result[] = _add_publication_types();
  $result[] = _add_custom_field_data();

  // _enable_biblio_keyword_vocabulary();
  $result[] = _set_system_weight();

  // @code
  // 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');
  // }
  // @endcode
}