function google_api_client_requirements in Google API PHP Client 8.2
Same name and namespace in other branches
- 8.4 google_api_client.install \google_api_client_requirements()
- 8.3 google_api_client.install \google_api_client_requirements()
Implements hook_requirements().
File
- ./
google_api_client.install, line 10 - Install and uninstall functions for the Google api client module.
Code
function google_api_client_requirements($phase) {
if ($phase != 'runtime') {
return [];
}
$library_exists = google_api_client_load_library();
$url = \Drupal\Core\Link::fromTextAndUrl(t('here'), \Drupal\Core\Url::fromUri('https://github.com/google/google-api-php-client/releases'))
->toString();
$documentation = \Drupal\Core\Link::fromTextAndUrl(t('google api php client installation'), \Drupal\Core\Url::fromUri('https://github.com/google/google-api-php-client#installation'))
->toString();
$version = isset($library_exists['versions']) && !empty($library_exists['versions']) ? array_keys($library_exists['versions']) : array(
'2.4.0',
);
return [
'google-api-php-client' => [
'title' => t('Google Api PHP Client'),
'value' => $library_exists ? t('Installed') . ' ' . Google_Client::LIBVER : t('Not installed'),
'description' => $library_exists ? '' : t('Install version "@version" or latest version of the Google api php client library code (from %here) in a libraries directory such as "libraries/google-api-php-client". You can also use composer to install, read more at %documentation. The path should be "libraries/google-api-php-client"', [
'@version' => $version[0],
'%here' => $url,
'%documentation' => $documentation,
]),
'severity' => $library_exists ? REQUIREMENT_OK : REQUIREMENT_ERROR,
],
];
}