You are here

function _users_export_requirements in Users Export 8

Implements hook_requirements().

Checks installation requirements and do status reporting. http://api.drupal.org/api/function/hook_requirements.

@codingStandardsIgnoreStart

@codingStandardsIgnoreEnd

Parameters

phase 'install' or 'runtime'::

Return value

A keyed array of requirements

// TODO This is not ported yet.

File

./users_export.install, line 43
Handles installation steps for users_export.

Code

function _users_export_requirements($phase) {
  $reqs = [];
  if ($phase == 'runtime') {
    $modules = [];
    if (!\Drupal::moduleHandler()
      ->moduleExists('loft_data_grids')) {
      $modules[] = 'loft_data_grids';
    }
    if ($modules) {
      $reqs['users_export'] = [
        'title' => t('Users Export Dependencies'),
        'description' => t('The following module(s) need to be enabled: %modules', [
          '%modules' => implode(', ', $modules),
        ]),
        'severity' => REQUIREMENT_ERROR,
        'value' => t('Missing'),
      ];
    }
    if (!function_exists('loft_data_grids_info')) {
      $reqs['users_export'] = [
        'title' => t('Users Export'),
        'description' => t('Please upgrade <a href="!url">Loft Data Grids</a> to the 2.x branch immediately!', [
          '!url' => Url::fromUri('http://www.intheloftstudios.com/packages/php/drupal_loft_data_grids'),
        ]),
        'severity' => REQUIREMENT_ERROR,
        'value' => t('Outdated dependency'),
      ];
    }
  }
  return $reqs;
}