You are here

function media_acquiadam_example_requirements in Media: Acquia DAM 8

Implements hook_requirements().

File

modules/media_acquiadam_example/media_acquiadam_example.install, line 65
Drupal install and update hooks.

Code

function media_acquiadam_example_requirements($phase) {
  $requirements = [];
  if ('runtime' === $phase) {
    $requirements['media_acquiadam_example_uninstall'] = [
      'title' => t('Media: Acquia DAM'),
      'description' => t('The Media: Acquia DAM - Example Configuration module has imported its configuration and can now be safely uninstalled.'),
      'severity' => REQUIREMENT_WARNING,
    ];
  }
  elseif ('install' === $phase) {
    $config_factory = Drupal::configFactory();
    if (!$config_factory
      ->get('media.type.acquia_dam_asset')
      ->isNew()) {
      $requirements['media_acquiadam_example_noinstall'] = [
        'title' => t('Media: Acquia DAM'),
        'description' => t('The Media: Acquia DAM - Example Configuration module has already been installed once and cannot be installed again.'),
        'severity' => REQUIREMENT_ERROR,
      ];
    }
  }
  return $requirements;
}