function paragraphs_ee_sets_requirements in Paragraphs Editor Enhancements 8
Implements hook_requirements().
File
- modules/
paragraphs_ee_sets/ paragraphs_ee_sets.install, line 19 - Installation hooks for paragraphs_ee_sets module.
Code
function paragraphs_ee_sets_requirements($phase) {
$requirements = [];
if (!in_array($phase, [
'install',
'runtime',
])) {
return $requirements;
}
// Check version of paragraphs module.
$module_info = \Drupal::service('extension.list.module')
->getExtensionInfo('paragraphs_sets');
if (empty($module_info['version'])) {
// Module checked out from git so we assume it is newer than required.
return $requirements;
}
if (version_compare($module_info['version'], '8.x-2.1', '<')) {
$requirements['paragraphs'] = [
'title' => t('Paragraphs version'),
'description' => t('You need to install at least version 8.x-2.1 of the %paragraphs_sets module (installed version is %version).', [
'%paragraphs' => 'Paragraphs Sets',
'%version' => $module_info['version'],
]),
'value' => t('Incompatible version'),
'severity' => REQUIREMENT_ERROR,
];
}
return $requirements;
}