You are here

function oauth2_server_requirements in OAuth2 Server 8

Same name and namespace in other branches
  1. 7 oauth2_server.install \oauth2_server_requirements()
  2. 2.0.x oauth2_server.install \oauth2_server_requirements()

Implements hook_requirements().

File

./oauth2_server.install, line 11
The Oauth2 Server module.

Code

function oauth2_server_requirements($phase) {
  $ret = [];
  if ($phase == 'runtime') {
    $found = class_exists('OAuth2\\Server');
    $description = \Drupal::translation()
      ->translate('The OAuth2 server library is required for the OAuth2 module to function. Download the library using composer, download it from <a href="https://github.com/bshaffer/oauth2-server-php">GitHub</a> or use composer manager.');
    $ret['oauth2'] = [
      'title' => \Drupal::translation()
        ->translate('OAuth2 server library'),
      'value' => $found ? \Drupal::translation()
        ->translate('Available') : \Drupal::translation()
        ->translate('Unavailable'),
      'description' => !$found ? $description : NULL,
      'severity' => $found ? REQUIREMENT_OK : REQUIREMENT_ERROR,
    ];
  }
  return $ret;
}