social_auth_drupal-8.x-1.x-dev/social_auth_drupal.install
social_auth_drupal.install
<?php
/**
* @file
* Install, update, and uninstall functions for the Social Auth Drupal module.
*/
use Drupal\social_api\Utility\SocialApiImplementerInstaller;
use Drupal\social_auth\Controller\SocialAuthController;
/**
* Implements hook_requirements().
*
* Checks that a compatible version of oAuth2 Drupal library for the
* league OAuth2 client with Composer. Check installation instructions
* from the README.txt.
*/
function social_auth_drupal_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_drupal', 'Social Auth Drupal', 'chrishemmings/oauth2-drupal', 2.0, 3.0);
}
return $requirements;
}
/**
* Implements hook_install().
*/
function social_auth_drupal_install() {
SocialAuthController::setLoginButtonSettings('social_auth_drupal', 'social_auth_drupal.redirect_to_drupal', 'img/drupal_logo.svg');
}
/**
* Implements hook_uninstall().
*/
function social_auth_drupal_uninstall() {
SocialAuthController::deleteLoginButtonSettings('social_auth_drupal');
}
