Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* @file
* Install, update, and uninstall functions for the Social Auth Digitalocean module.
*/
use Drupal\social_api\Utility\SocialApiImplementerInstaller;
use Drupal\social_auth\Controller\SocialAuthController;
/**
* Implements hook_requirements().
*
* Checks that a compatible version of oAuth2 Digitalocean library for the
* league OAuth2 client with Composer. Check installation instructions
* from the README.txt.
*/
function social_auth_digitalocean_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_digitalocean', 'Social Auth Digitalocean', 'chrishemmings/oauth2-digitalocean', 2.0, 3.0);
}
return $requirements;
}
/**
* Implements hook_install().
*/
function social_auth_digitalocean_install() {
SocialAuthController::setLoginButtonSettings('social_auth_digitalocean', 'social_auth_digitalocean.redirect_to_digitalocean', 'img/digitalocean_logo.svg');
}
/**
* Implements hook_uninstall().
*/
function social_auth_digitalocean_uninstall() {
SocialAuthController::deleteLoginButtonSettings('social_auth_digitalocean');
}