You are here

social_auth_google.install in Social Auth Google 8

Same filename and directory in other branches
  1. 8.2 social_auth_google.install
  2. 3.x social_auth_google.install

Install and uninstall functions for the Google Login module.

File

social_auth_google.install
View source
<?php

/**
 * @file
 * Install and uninstall functions for the Google Login module.
 */
use Drupal\social_api\Utility\SocialApiImplementerInstaller;
use Drupal\social_auth\Controller\SocialAuthController;

/**
 * Implements hook_requirements().
 */
function social_auth_google_requirements($phase) {
  $requirements = [];

  // Social API should be installed at this point in order to check library.
  \Drupal::service('module_installer')
    ->install([
    'social_api',
  ]);
  if ($phase == 'install') {
    $requirements = SocialApiImplementerInstaller::checkLibrary('social_auth_google', 'Social Auth Google', 'google/apiclient', 2.0, 3.0);
  }
  return $requirements;
}

/**
 * Implements hook_install().
 */
function social_auth_google_install() {
  SocialAuthController::setLoginButtonSettings('social_auth_google', 'social_auth_google.redirect_to_google', 'img/google_logo.svg');
}

/**
 * Implements hook_uninstall().
 */
function social_auth_google_uninstall() {
  SocialAuthController::deleteLoginButtonSettings('social_auth_google');
}