You are here

function gauth_load_library in Google Auth 8

4 calls to gauth_load_library()
Gauth::getGauthClient in src/Entity/Gauth.php
Function to retrieve the google client for different operations.
GauthResponseHandler::responseHandler in src/Entity/Controller/GauthResponseHandler.php
Function handles google response.
gauth_requirements in ./gauth.install
Implements hook_requirements().
_gauth_read_scope_info in ./gauth.module
Helper function which reads the installed library and discovery api to build cache for scopes and names.

File

./gauth.module, line 152
Google Auth Api for drupal.

Code

function gauth_load_library($return_path = FALSE) {
  $library = \Drupal::service('library.discovery')
    ->getLibraryByName('gauth', 'google-api-php-client');
  if ($library) {
    if (class_exists('Google_Client')) {

      // Composer install so no problem with lib.
      if ($return_path) {
        return '';
      }
      return TRUE;
    }
    else {
      $php_files = array_keys($library['php']);
      $library_exists = file_exists($php_files[0]);
      if ($library_exists) {
        require_once $php_files[0];
        if ($return_path) {
          return 'libraries/google-api-php-client/';
        }
        return TRUE;
      }
    }
  }
  return FALSE;
}