bibcite.install in Bibliography & Citation 8
Same filename and directory in other branches
Module installation hooks implementation.
File
bibcite.installView source
<?php
/**
* @file
* Module installation hooks implementation.
*/
/**
* Implements hook_requirements().
*/
function bibcite_requirements($phase) {
$requirements = [];
switch ($phase) {
case 'runtime':
case 'install':
if (!class_exists('\\AcademicPuma\\CiteProc\\CiteProc') || !class_exists('\\ADCI\\FullNameParser\\Parser')) {
$requirements['bibcite_dependencies'] = [
'title' => t('Bibliography & Citation dependencies'),
'description' => t("Bibliography & Citation requires the academicpuma/citeproc-php and adci/full-name-parser libraries. See the module's README.md file for more information."),
'severity' => REQUIREMENT_ERROR,
];
}
}
return $requirements;
}
/**
* Delete "links" from bibcite.settings configuration.
*/
function bibcite_update_8001() {
$config_factory = \Drupal::configFactory();
$config = $config_factory
->getEditable('bibcite.settings');
$config
->clear('links');
$config
->save(TRUE);
}
/**
* Add config_export property to CSL style config entity.
*/
function bibcite_update_8002() {
$definition_update_manager = \Drupal::entityDefinitionUpdateManager();
// Update CSL style entity.
$bibcite_csl_style = $definition_update_manager
->getEntityType('bibcite_csl_style');
$bibcite_csl_style
->set('config_export', [
'id',
'parent',
'label',
'csl',
'updated',
'custom',
'url_id',
'override',
'preview_mode',
'citekey_pattern',
'fields',
]);
$definition_update_manager
->updateEntityType($bibcite_csl_style);
}
Functions
Name | Description |
---|---|
bibcite_requirements | Implements hook_requirements(). |
bibcite_update_8001 | Delete "links" from bibcite.settings configuration. |
bibcite_update_8002 | Add config_export property to CSL style config entity. |