You are here

function zoomapi_requirements in Zoom API 8

Same name and namespace in other branches
  1. 2.0.x zoomapi.install \zoomapi_requirements()

Implements hook_requirements().

File

./zoomapi.install, line 13
Install, update, and uninstall functions for the Zoom API module.

Code

function zoomapi_requirements($phase) {
  $requirements = [];
  if ($phase == 'runtime') {
    $client = \Drupal::service('zoomapi.client');
    $credentials_are_valid = $client
      ->validateConfiguration();
    if (!$credentials_are_valid) {
      $link_to_settings = Url::fromRoute('zoomapi.settings')
        ->toString();
      $message = t('Missing valid configuration for Zoom API. Please go <a href=":link_to_settings">here</a> to set.', [
        ':link_to_settings' => $link_to_settings,
      ]);
      $requirements['zoomapi'] = [
        'title' => t('Zoom API - Configuration'),
        'severity' => REQUIREMENT_ERROR,
        'description' => $message,
      ];
    }
  }
  return $requirements;
}