function scss_compiler_requirements in SCSS/Less Compiler 8
Implements hook_requirements().
File
- ./
scss_compiler.install, line 14 - Install, update and uninstall functions for the SCSS Compiler module.
Code
function scss_compiler_requirements($phase) {
$requirements = [];
if ($phase === 'runtime') {
$description = '';
if (!($installed = class_exists('ScssPhp\\ScssPhp\\Compiler') || file_exists(DRUPAL_ROOT . '/libraries/scssphp/scss.inc.php'))) {
$url = Url::fromUri('https://github.com/scssphp/scssphp/releases', [
'external' => TRUE,
]);
$link = Link::fromTextAndUrl(t('Download'), $url);
$description = t('SCSS compiler library not found. Download library and place it to drupal libraries folder. @link', [
'@link' => $link
->toString(),
]);
}
$requirements['scss_compiler'] = [
'title' => t('SCSS Compiler library'),
'value' => $installed ? t('Installed') : t('Not installed'),
'severity' => $installed ? REQUIREMENT_OK : REQUIREMENT_ERROR,
'description' => $description,
];
}
return $requirements;
}