-
Notifications
You must be signed in to change notification settings - Fork 0
/
distributors.install
45 lines (37 loc) · 1.11 KB
/
distributors.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
<?php
/**
* @file
* Contains distributors.install
*/
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Entity\EntityInterface;
/**
* Implements hook_requirements().
*/
function distributors_requirements($phase) {
$requirements = array();
// Report Drupal version
if ($phase == 'install') {
$info = \Drupal\node\Entity\NodeType::load('distributor');
if($info != false) {
$requirements['distributor'] = array(
'title' => t('Distributors module'),
'description' => t('Distributor content type already exists! Please delete the distributor content type first, in order to install the module.'),
'value' => t('1.0'),
'severity' => REQUIREMENT_ERROR,
);
}
else {
$requirements['distributor'] = array(
'title' => t('Distributors module'),
'description' => t('Distributor module installed successfully!'),
'value' => t('1.0'),
'severity' => REQUIREMENT_OK,
);
}
}
return $requirements;
}