You are here

function media_entity_actions_requirements in Media Entity Actions 8

Same name and namespace in other branches
  1. 8.2 media_entity_actions.install \media_entity_actions_requirements()

Implements hook_requirements().

File

./media_entity_actions.install, line 11
Install, uninstall and update hooks for Media Entity Actions module.

Code

function media_entity_actions_requirements($phase) {
  $requirements = [];

  // Prevent installation if Media Entity 1.x is enabled.
  if (\Drupal::moduleHandler()
    ->moduleExists('media_entity')) {
    $info = system_get_info('module', 'media_entity');
    if (version_compare($info['version'], '8.x-2') < 0) {
      $requirements['media_entity_generic_incompatibility'] = [
        'title' => t('Media'),
        'description' => t('The Media Entity Actions module is not compatible with contrib <a href=":url">Media Entity</a> 1.x branch. You don\'t need to enable this module manually, when performing the upgrade to Media in core, this module will be automatically enabled.', [
          ':url' => 'https://drupal.org/project/media_entity',
        ]),
        'severity' => REQUIREMENT_ERROR,
      ];
    }
  }
  return $requirements;
}