-
Notifications
You must be signed in to change notification settings - Fork 0
/
kifibundle.module
44 lines (36 loc) · 1.24 KB
/
kifibundle.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
<?php
use Drupal\Core\Form\FormStateInterface;
function kifibundle_form_system_logging_settings_alter(&$form, FormStateInterface $form_state) {
$config = Drupal::configFactory()->getEditable('kifibundle.logging');
$log_errors = $config->get('log_errors');
$form['kifibundle'] = [
'#tree' => true,
'log_errors' => [
'#type' => 'checkboxes',
'#title' => t('Logged HTTP errors'),
'#options' => [
403 => t('403 - Forbidden'),
404 => t('404 - Not Found'),
],
'#default_value' => $log_errors,
]
];
$form['#submit'][] = 'kifibundle_logging_settings_submit';
}
function kifibundle_logging_settings_submit(&$form, FormStateInterface $form_state) {
$log_errors = $form_state->getValue(['kifibundle', 'log_errors']);
$log_errors = array_keys(array_filter($log_errors));
$config = Drupal::configFactory()->getEditable('kifibundle.logging');
$config->set('log_errors', array_filter($log_errors));
$config->save();
}
function kifibundle_views_data() {
$data['views']['kifibundle_twig_inline'] = [
'title' => t('Inline template'),
'help' => t('Render text as template. Twig formatting is supported.'),
'area' => [
'id' => 'kifibundle_twig_inline'
]
];
return $data;
}