Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / system / src / Form / LoggingForm.php
1 <?php
2
3 namespace Drupal\system\Form;
4
5 use Drupal\Core\Form\ConfigFormBase;
6 use Drupal\Core\Form\FormStateInterface;
7
8 /**
9  * Configure logging settings for this site.
10  */
11 class LoggingForm extends ConfigFormBase {
12
13   /**
14    * {@inheritdoc}
15    */
16   public function getFormId() {
17     return 'system_logging_settings';
18   }
19
20   /**
21    * {@inheritdoc}
22    */
23   protected function getEditableConfigNames() {
24     return ['system.logging'];
25   }
26
27   /**
28    * {@inheritdoc}
29    */
30   public function buildForm(array $form, FormStateInterface $form_state) {
31     $config = $this->config('system.logging');
32     $form['error_level'] = [
33       '#type' => 'radios',
34       '#title' => t('Error messages to display'),
35       '#default_value' => $config->get('error_level'),
36       '#options' => [
37         ERROR_REPORTING_HIDE => t('None'),
38         ERROR_REPORTING_DISPLAY_SOME => t('Errors and warnings'),
39         ERROR_REPORTING_DISPLAY_ALL => t('All messages'),
40         ERROR_REPORTING_DISPLAY_VERBOSE => t('All messages, with backtrace information'),
41       ],
42       '#description' => t('It is recommended that sites running on production environments do not display any errors.'),
43     ];
44
45     return parent::buildForm($form, $form_state);
46   }
47
48   /**
49    * {@inheritdoc}
50    */
51   public function submitForm(array &$form, FormStateInterface $form_state) {
52     $this->config('system.logging')
53       ->set('error_level', $form_state->getValue('error_level'))
54       ->save();
55
56     parent::submitForm($form, $form_state);
57   }
58
59 }