You are here

bibcite_bibtex.install in Bibliography & Citation 2.0.x

Same filename and directory in other branches
  1. 8 modules/bibcite_bibtex/bibcite_bibtex.install

Module installation hooks implementation.

File

modules/bibcite_bibtex/bibcite_bibtex.install
View source
<?php

/**
 * @file
 * Module installation hooks implementation.
 */

/**
 * Implements hook_requirements().
 */
function bibcite_bibtex_requirements($phase) {
  $requirements = [];
  switch ($phase) {
    case 'runtime':
    case 'install':
      if (!class_exists('\\AudioLabs\\BibtexParser\\BibtexParser')) {
        $requirements['bibcite_bibtex_dependencies'] = [
          'title' => t('BibTeX dependencies'),
          'description' => t("Bibliography &amp; Citation - BibTeX requires the audiolabs/bibtexparser library. See the module's README.md file for more information."),
          'severity' => REQUIREMENT_ERROR,
        ];
      }
  }
  return $requirements;
}

/**
 * Set mapping of bibtex language field.
 */
function bibcite_bibtex_update_8001() {
  $config_factory = \Drupal::configFactory();
  $config = $config_factory
    ->getEditable('bibcite_entity.mapping.bibtex');
  $fields = $config
    ->get('fields');
  $fields['language'] = 'bibcite_lang';
  $config
    ->set('fields', $fields);
  $config
    ->save(TRUE);
}

/**
 * Implements hook_uninstall().
 */
function bibcite_bibtex_uninstall() {
  Drupal::configFactory()
    ->getEditable('bibcite_entity.mapping.bibtex')
    ->delete();
}

Functions

Namesort descending Description
bibcite_bibtex_requirements Implements hook_requirements().
bibcite_bibtex_uninstall Implements hook_uninstall().
bibcite_bibtex_update_8001 Set mapping of bibtex language field.