6781c8f70c81ac5d4b966d2d2655f0f6619462bc
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Setting / General / Forms / FormsSmartDescriptionsAllowedTags.php
1 <?php
2 /**
3  * @file
4  * Contains \Drupal\bootstrap\Plugin\Setting\General\Forms\FormsSmartDescriptionsAllowedTags.
5  */
6
7 namespace Drupal\bootstrap\Plugin\Setting\General\Forms;
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 "forms_smart_descriptions_allowed_tags" theme setting.
17  *
18  * @ingroup plugins_setting
19  *
20  * @BootstrapSetting(
21  *   id = "forms_smart_descriptions_allowed_tags",
22  *   type = "textfield",
23  *   title = @Translation("Smart form descriptions allowed (HTML) tags"),
24  *   defaultValue = "b, code, em, i, kbd, span, strong",
25  *   description = @Translation("Prevents descriptions from becoming tooltips by checking for HTML not in the list above (i.e. links). Separate by commas. To disable this filtering criteria, leave an empty value."),
26  *   groups = {
27  *     "general" = @Translation("General"),
28  *     "forms" = @Translation("Forms"),
29  *   },
30  * )
31  */
32 class FormsSmartDescriptionsAllowedTags 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="forms_smart_descriptions"]' => ['checked' => TRUE],
42       ],
43     ]);
44   }
45
46 }