social_auth_esia-8.x-1.0-rc2/social_auth_esia.install
social_auth_esia.install
<?php
/**
* @file
* Install, update, and uninstall functions for the Social Auth ESIA module.
*/
use Drupal\social_api\Utility\SocialApiImplementerInstaller;
use Drupal\social_auth\Controller\SocialAuthController;
/**
* Implements hook_requirements().
*
* Checks that a compatible version of ekapusta/oauth2-esia is
* installed.
*/
function social_auth_esia_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_esia', 'Social Auth ESIA', 'ekapusta/oauth2-esia', 1.0, 2.0);
}
return $requirements;
}
/**
* Implements hook_install().
*/
function social_auth_esia_install() {
SocialAuthController::setLoginButtonSettings('social_auth_esia', 'social_auth_esia.redirect_to_esia', 'assets/img/esia_square_logo.svg');
}
/**
* Implements hook_uninstall().
*/
function social_auth_esia_uninstall() {
SocialAuthController::deleteLoginButtonSettings('social_auth_esia');
}
