forked from pavlosdan/sitestudio_gin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsitestudio_gin.install
49 lines (39 loc) · 1.15 KB
/
sitestudio_gin.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
<?php
/**
* @file
* Site Studio Gin Installation Checks.
*
* "Borrowed" from gin_toolbar.
*/
use Drupal\Core\Installer\InstallerKernel;
/**
* Implements hook_requirements().
*/
function sitestudio_gin_requirements($phase) {
$requirements = [];
if ($phase !== 'install') {
return $requirements;
}
// We need to check if Gin theme is installed.
$installed = \Drupal::service('theme_handler')->themeExists('gin');
// Gin is installed everything's fine.
if ($installed) {
return $requirements;
}
global $install_state;
// Check if Drupal should be installed and gin in is in the install profile.
if (
InstallerKernel::installationAttempted()
&& isset($install_state['profile_info']['themes'])
&& in_array('gin', $install_state['profile_info']['themes'], TRUE)
) {
return $requirements;
}
// Gin is not installed and it's not supposed to be installed.
$requirements['gin'] = [
'title' => t('Gin'),
'description' => t('The Site Studio Gin module works with <a href="https://www.drupal.org/project/gin" target="_blank">Gin</a> theme only'),
'severity' => REQUIREMENT_ERROR,
];
return $requirements;
}