You are here

gauth.install in Google Auth 8

Same filename and directory in other branches
  1. 7.2 gauth.install
  2. 7 gauth.install

Install and uninstall functions for the Google OAuth module.

File

gauth.install
View source
<?php

/**
 * @file
 * Install and uninstall functions for the Google OAuth module.
 */

/**
 * Implements hook_requirements().
 */
function gauth_requirements($phase) {
  if ($phase != 'runtime') {
    return [];
  }
  $library_exists = gauth_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,
    ],
  ];
}

Functions

Namesort descending Description
gauth_requirements Implements hook_requirements().