You are here

function lti_tool_provider_requirements in LTI Tool Provider 2.x

Same name and namespace in other branches
  1. 8 lti_tool_provider.install \lti_tool_provider_requirements()
  2. 7 lti_tool_provider.install \lti_tool_provider_requirements()

Implements hook_requirements().

Parameters

$phase:

Return value

array

File

./lti_tool_provider.install, line 15
Installation and schema related functions for the LTI Tool Provider module.

Code

function lti_tool_provider_requirements($phase) : array {
  $requirements = [];
  $oauth_available = class_exists('\\OauthProvider');
  if ($oauth_available) {
    $requirements['lti_tool_provider_oauth'] = [
      'title' => t('LTI Tool Provider - OAuth'),
      'value' => t('OAuth PECL library installed'),
    ];
  }
  else {
    $requirements['lti_tool_provider_oauth'] = [
      'title' => t('LTI Tool Provider - OAuth'),
      'severity' => REQUIREMENT_ERROR,
      'description' => t('The LTI Tool Provider module requires the <a href="https://www.php.net/manual/en/book.oauth.php" target="_blank">PECL OAuth</a> library.'),
    ];
    if ($phase == 'runtime') {
      $requirements['lti_tool_provider_oauth'] += [
        'value' => t('OAuth PECL library not installed'),
      ];
    }
  }
  return $requirements;
}