addtohomescreen.install in Add to homescreen 8
Same filename and directory in other branches
Install, update and uninstall functions for the addtohomescreen module.
File
addtohomescreen.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the addtohomescreen module.
*/
/**
* Implements hook_requirements().
*/
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;
}
Functions
Name | Description |
---|---|
addtohomescreen_requirements | Implements hook_requirements(). |