You are here

function simplesamlphp_auth_requirements in simpleSAMLphp Authentication 8.3

Same name and namespace in other branches
  1. 7.3 simplesamlphp_auth.install \simplesamlphp_auth_requirements()
  2. 7.2 simplesamlphp_auth.install \simplesamlphp_auth_requirements()

Implements hook_requirements().

File

./simplesamlphp_auth.install, line 47
The install file for the simplesamlphp_auth module.

Code

function simplesamlphp_auth_requirements($phase) {
  $requirements = [];
  if ($phase == 'install') {
    simplesamlphp_auth_check_library();
    if (!class_exists('SimpleSAML\\Configuration')) {
      $requirements['simplesamlphp_library'] = [
        'description' => t('SimpleSAMLphp module requires the simplesamlphp library, version 1.18.2 or later. See README file for installation instructions.'),
        'severity' => REQUIREMENT_ERROR,
      ];
    }
  }
  if ($phase == 'runtime') {
    $config = \Drupal::config('simplesamlphp_auth.settings');
    if (!$config
      ->get('activate')) {
      $requirements['simplesamlphp_auth'] = [
        'severity' => REQUIREMENT_INFO,
        'title' => 'simpleSAMLphp_auth',
        'value' => t('SimpleSAMLphp authentication is NOT activated'),
        'description' => t('It can be activated on the <a href=":config_page">configuration page</a>.', [
          ':config_page' => Url::fromRoute('simplesamlphp_auth.admin_settings')
            ->toString(),
        ]),
      ];
    }
  }
  return $requirements;
}