function gridstack_requirements in GridStack 8.2
Same name and namespace in other branches
- 8 gridstack.install \gridstack_requirements()
Implements hook_requirements().
File
- ./
gridstack.install, line 18 - Installation actions for GridStack.
Code
function gridstack_requirements($phase) {
if ($phase != 'runtime') {
return [];
}
$path = gridstack_libraries_get_path('gridstack') ?: \Drupal::root() . '/libraries/gridstack';
$exists = is_file($path . '/dist/gridstack.min.js');
return [
'gridstack_library' => [
'title' => t('GridStack library'),
'description' => $exists ? '' : t('The <a href=":url">GridStack library</a> should be installed at <strong>/libraries/gridstack/dist/gridstack.min.js</strong>, or any path supported by core D8.9 library finder, or libraries.module if installed. Check out file or folder permissions if troubled.', [
':url' => 'https://github.com/gridstack/gridstack.js',
]),
'severity' => $exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
'value' => $exists ? t('Installed') : t('Not installed'),
],
];
}