Version 1
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Setting / Advanced / SuppressDeprecatedWarnings.php
1 <?php
2 /**
3  * @file
4  * Contains \Drupal\bootstrap\Plugin\Setting\Advanced\SuppressDeprecatedWarnings.
5  */
6
7 namespace Drupal\bootstrap\Plugin\Setting\Advanced;
8
9 use Drupal\bootstrap\Annotation\BootstrapSetting;
10 use Drupal\bootstrap\Plugin\Setting\SettingBase;
11 use Drupal\bootstrap\Utility\Element;
12 use Drupal\Core\Annotation\Translation;
13 use Drupal\Core\Form\FormStateInterface;
14
15 /**
16  * The "suppress_deprecated_warnings" theme setting.
17  *
18  * @ingroup plugins_setting
19  *
20  * @BootstrapSetting(
21  *   id = "suppress_deprecated_warnings",
22  *   type = "checkbox",
23  *   weight = -2,
24  *   title = @Translation("Suppress deprecated warnings"),
25  *   defaultValue = 0,
26  *   description = @Translation("Enable this setting if you wish to suppress deprecated warning messages. <strong class='error text-error'>WARNING: Suppressing these messages does not &quote;fix&quote; the problem and you will inevitably encounter issues when they are removed in future updates. Only use this setting in extreme and necessary circumstances.</strong>"),
27  *   groups = {
28  *     "advanced" = @Translation("Advanced"),
29  *   },
30  * )
31  */
32 class SuppressDeprecatedWarnings extends SettingBase {
33
34   /**
35    * {@inheritdoc}
36    */
37   public function alterFormElement(Element $form, FormStateInterface $form_state, $form_id = NULL) {
38     $setting = $this->getSettingElement($form, $form_state);
39     $setting->setProperty('states', [
40       'visible' => [
41         ':input[name="include_deprecated"]' => ['checked' => TRUE],
42       ],
43     ]);
44   }
45
46 }