function image_lazy_loader_requirements in Image Lazy Loader 8
Implements hook_requirements().
File
- ./
image_lazy_loader.install, line 13 - Check requirements for lazy loader module.
Code
function image_lazy_loader_requirements($phase) {
$requirements = [];
if ($phase == 'install' || $phase == 'runtime') {
$plugin_detected = file_exists(DRUPAL_ROOT . '/libraries/lozad/dist/lozad.min.js');
if ($plugin_detected) {
$requirements['lozad'] = [
'title' => t('Lozad'),
'value' => t('Plugin detected'),
'severity' => REQUIREMENT_OK,
];
}
else {
$requirements['lozad'] = [
'title' => t('Lozad'),
'value' => t('Plugin not detected'),
'severity' => REQUIREMENT_ERROR,
'description' => t('Before you can use the Image Lazy Loader module, you need to download the Lozad plugin from Github and place it in /libraries/lozad. Check the README.txt for more information. <a href=":plugin_url">Get the Lozad plugin here</a>.', [
':plugin_url' => 'https://github.com/ApoorvSaxena/lozad.js',
]),
];
}
}
return $requirements;
}