-
Notifications
You must be signed in to change notification settings - Fork 1
/
social_auth_pbs.install
54 lines (44 loc) · 1.19 KB
/
social_auth_pbs.install
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
46
47
48
49
50
51
52
53
54
<?php
/**
* @file
* Install, update, and uninstall functions for the Social Auth PBS.
*/
use Drupal\social_api\Utility\SocialApiImplementerInstaller;
use Drupal\social_auth\Controller\SocialAuthController;
/**
* Implements hook_requirements().
*
* Checks that a compatible version of PHP League OAuth2 PBS library is
* available. Check installation instructions from the README.md.
*/
function social_auth_pbs_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_pbs',
'Social Auth PBS',
'openpublicmedia/oauth2-pbs',
1.0,
2.0
);
}
return $requirements;
}
/**
* Implements hook_install().
*/
function social_auth_pbs_install() {
SocialAuthController::setLoginButtonSettings(
'social_auth_pbs',
'social_auth_pbs.redirect_to_pbs',
'img/pbs_logo.svg'
);
}
/**
* Implements hook_uninstall().
*/
function social_auth_pbs_uninstall() {
SocialAuthController::deleteLoginButtonSettings('social_auth_pbs');
}