function addtohomescreen_requirements in Add to homescreen 8
Same name and namespace in other branches
- 7 addtohomescreen.install \addtohomescreen_requirements()
Implements hook_requirements().
File
- ./
addtohomescreen.install, line 11 - Install, update and uninstall functions for the addtohomescreen module.
Code
function addtohomescreen_requirements($phase) {
$requirements = [];
if ($phase == 'runtime') {
$library = \Drupal::service('library.discovery')
->getLibraryByName('addtohomescreen', 'addtohomescreen');
if (!$library || isset($library['js'][0]['data']) && !file_exists($library['js'][0]['data'])) {
$requirements['addtohomescreen'] = [
'title' => t('Add to homescreen'),
'value' => t('Add to homescreen library could not be found, check the <a href="@readme_url">installation instructions</a> for the Add to homescreen module.', [
'@readme_url' => '/' . drupal_get_path('module', 'addtohomescreen') . '/README.txt',
]),
'severity' => REQUIREMENT_ERROR,
];
}
}
return $requirements;
}