sidr.install in Sidr: Accessible Mobile Menus 8
Same filename and directory in other branches
Install and uninstall hooks for the sidr module.
File
sidr.installView source
<?php
/**
* @file
* Install and uninstall hooks for the sidr module.
*/
/**
* Implements hook_requirements().
*/
function sidr_requirements($phase) {
if ($phase != 'runtime') {
return [];
}
// Sidr libraries must be installed.
$library = \Drupal::service('library.discovery')
->getLibraryByName('sidr', 'sidr');
$library_exists = file_exists(DRUPAL_ROOT . '/' . $library['js'][0]['data']);
return [
'sidr_library_downloaded' => [
'title' => t('Sidr library'),
'value' => $library_exists ? t('Installed') : t('Not installed'),
'description' => $library_exists ? '' : t('The Sidr library needs to be downloaded. See the README file in the module for instructions.'),
'severity' => $library_exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
],
];
}
Functions
Name | Description |
---|---|
sidr_requirements | Implements hook_requirements(). |