function media_entity_requirements in Media entity 8
Same name and namespace in other branches
- 8.2 media_entity.install \media_entity_requirements()
Implements hook_requirements().
File
- ./
media_entity.install, line 30 - Install, uninstall and update hooks for Media entity module.
Code
function media_entity_requirements($phase) {
$requirements = [];
if ($phase == 'update' && !_media_entity_check_entity_version()) {
$requirements['entity'] = [
'title' => t('Media entity'),
'value' => t('Entity API missing'),
'description' => t('<a href=":url">Entity API >= 8.x-1.0-alpha3</a> module is now a dependency and needs to be installed before running updates.', [
':url' => 'https://www.drupal.org/project/entity',
]),
'severity' => REQUIREMENT_ERROR,
];
}
if ($phase == 'install' && \Drupal::moduleHandler()
->moduleExists('media')) {
$version = explode('.', \Drupal::VERSION);
if ($version[1] >= 4) {
$requirements['media_module_incompatibility'] = [
'title' => t('Media Entity'),
'value' => t('The Media Entity module is not compatible with media in core.'),
'description' => t('The 1.x branch of Media Entity cannot be used in conjunction with the media module in core. Please check the 2.x branch for an upgrade path.'),
'severity' => REQUIREMENT_ERROR,
];
}
}
return $requirements;
}