-
Notifications
You must be signed in to change notification settings - Fork 0
/
d8.install
66 lines (56 loc) · 1.34 KB
/
d8.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
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* @file
* Install, update and uninstall functions for the d8 installation profile.
*/
use Drupal\d8\D8Setup;
use Drupal\d8\Form\D8CaptchaForm;
use Drupal\d8\Form\D8ConfigureForm;
/**
* Implements hook_install().
*/
function d8_install(bool $is_syncing): void {
if (!$is_syncing) {
\Drupal::classResolver(D8Setup::class)->install();
}
}
/**
* Implements hook_install_tasks().
*/
function d8_install_tasks(array &$install_state): array {
return [
'install_captcha_form' => [
'display_name' => t('Set up captcha settings'),
'type' => 'form',
'function' => D8CaptchaForm::class,
],
];
}
/**
* Implements hook_install_tasks_alter().
*/
function d8_install_tasks_alter(array &$tasks, array $install_state): void {
$tasks['install_configure_form']['function'] = D8ConfigureForm::class;
}
/**
* Implements hook_update_last_removed().
*/
function d8_update_last_removed(): int {
return 10203;
}
/**
* Process list of update hooks.
*
* @param int[] ...
* The update hook identifiers.
*/
function _d8_update(): void {
$item = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 1)[0];
if (preg_match('#([^/]+)\.install$#', $item['file'], $matches)) {
$sandbox = [];
foreach (func_get_args() as $number) {
$function = $matches[1] . '_update_' . $number;
$function($sandbox);
}
}
}