file TextFormat.php

Namespace

Drupal\bootstrap\Plugin\Process
  1. <?php
  2. namespace Drupal\bootstrap\Plugin\Process;
  3. use Drupal\bootstrap\Bootstrap;
  4. use Drupal\bootstrap\Utility\Element;
  5. use Drupal\Core\Form\FormStateInterface;
  6. /**
  7. * Processes the "text_format" element.
  8. *
  9. * @ingroup plugins_process
  10. *
  11. * @BootstrapProcess("text_format")
  12. *
  13. * @see \Drupal\filter\Element\TextFormat::processFormat()
  14. */
  15. class TextFormat extends ProcessBase implements ProcessInterface {
  16. /**
  17. * {@inheritdoc}
  18. */
  19. public static function processElement(Element $element, FormStateInterface $form_state, array &$complete_form) {
  20. // Don't add the form-group class to the actual textarea element since
  21. // text_format elements are already wrapped.
  22. $element->value->setProperty('form_group', FALSE);
  23. if (isset($element->format)) {
  24. $element->format->addClass(['filter-wrapper', 'form-inline']);
  25. // Guidelines (removed).
  26. $element->format->guidelines->setProperty('access', FALSE)
  27. ->addClass('filter-guidelines');
  28. // Format (select).
  29. $element->format->format
  30. ->addClass(['filter-list', 'input-sm'])
  31. ->setProperty('title_display', 'invisible')
  32. ->setProperty('weight', -10);
  33. // Help (link).
  34. $element->format->help->addClass('filter-help');
  35. $element->format->help->about
  36. ->setAttribute('title', t('Opens in new window'))
  37. ->setProperty('icon', Bootstrap::glyphicon('question-sign'));
  38. if (Bootstrap::getTheme()->getSetting('tooltip_enabled')) {
  39. $element->format->help->about->setAttribute('data-toggle', 'tooltip');
  40. }
  41. }
  42. }
  43. }

Classes

Name Description
TextFormat Processes the "text_format" element.