mason-8.x-1.x-dev/mason.install
mason.install
<?php
/**
* @file
* Installation actions for Mason.
*/
/**
* Implements hook_requirements().
*/
function mason_requirements($phase) {
if ($phase != 'runtime') {
return [];
}
// Mason library.
$path = blazy()->getLibrariesPath('mason') ?: \Drupal::root() . '/libraries/mason';
$exists = FALSE;
if ($path && is_dir($path)) {
$exists = is_file($path . '/dist/mason.min.js');
}
return [
'mason_library' => [
'title' => t('Mason library'),
'description' => $exists ? '' : t('The <a href=":url">Mason library</a> should be installed at <strong>/libraries/mason/dist/mason.min.js</strong>, or any path supported by libraries.module if installed. Check out file or folder permissions if troubled.', [':url' => 'https://github.com/DrewDahlman/mason']),
'severity' => $exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
'value' => $exists ? t('Installed') : t('Not installed'),
],
];
}
