-
Notifications
You must be signed in to change notification settings - Fork 1
/
config_delete.module
48 lines (41 loc) · 1.18 KB
/
config_delete.module
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
<?php
/**
* @file
* This is the primary module file.
*/
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function config_delete_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.config_delete':
$output = '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Delete configuration items from the UI.') . '</p>';
return $output;
}
}
/**
* Implements hook_form_alter().
*/
function config_delete_form_alter(&$form, FormStateInterface $form_state, $form_id) {
if ($form_id == 'config_delete_form') {
unset($form['export']);
$form['config_delete_notice'] = [
'#type' => 'markup',
'#markup' => t('Notice: Deleting configuration items can potentially break your site! Please use this form only if you know what are you doing.'),
'#prefix' => '<strong>',
'#suffix' => '</strong>',
'#weight' => -100,
];
$form['delete_dependencies'] = [
'#type' => 'checkbox',
'#title' => t('Delete config dependencies'),
];
$form['submit'] = [
'#type' => 'submit',
'#value' => t('Delete'),
];
}
}