77c8892bdd7d3a7952a65501094ddb974db204d1
[yaffs-website] / web / themes / contrib / bootstrap / src / Plugin / Setting / General / Forms / FormsSmartDescriptionsAllowedTags.php
1 <?php
2
3 namespace Drupal\bootstrap\Plugin\Setting\General\Forms;
4
5 use Drupal\bootstrap\Plugin\Setting\SettingBase;
6 use Drupal\bootstrap\Utility\Element;
7 use Drupal\Core\Form\FormStateInterface;
8
9 /**
10  * The "forms_smart_descriptions_allowed_tags" theme setting.
11  *
12  * @ingroup plugins_setting
13  *
14  * @BootstrapSetting(
15  *   id = "forms_smart_descriptions_allowed_tags",
16  *   type = "textfield",
17  *   title = @Translation("Smart form descriptions allowed (HTML) tags"),
18  *   defaultValue = "b, code, em, i, kbd, span, strong",
19  *   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."),
20  *   groups = {
21  *     "general" = @Translation("General"),
22  *     "forms" = @Translation("Forms"),
23  *   },
24  * )
25  */
26 class FormsSmartDescriptionsAllowedTags extends SettingBase {
27
28   /**
29    * {@inheritdoc}
30    */
31   public function alterFormElement(Element $form, FormStateInterface $form_state, $form_id = NULL) {
32     $setting = $this->getSettingElement($form, $form_state);
33     $setting->setProperty('states', [
34       'visible' => [
35         ':input[name="forms_smart_descriptions"]' => ['checked' => TRUE],
36       ],
37     ]);
38   }
39
40 }