file FormsSmartDescriptionsAllowedTags.php

Namespace

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

Classes

Name Description
FormsSmartDescriptionsAllowedTags The "forms_smart_descriptions_allowed_tags" theme setting.