function public static function TextFormat::processElement

8.x-3.x TextFormat.php public static TextFormat::processElement(Element $element, FormStateInterface $form_state, array &$complete_form)

Process a specific form element.

Parameters

\Drupal\bootstrap\Utility\Element $element: The element object.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

array $complete_form: The complete form structure.

Overrides ProcessBase::processElement

Class

TextFormat
Processes the "text_format" element.

Namespace

Drupal\bootstrap\Plugin\Process

Source src/Plugin/Process/TextFormat.php (line 23)

public static function processElement(Element $element, FormStateInterface $form_state, array &$complete_form) {
  // Don't add the form-group class to the actual textarea element since
  // text_format elements are already wrapped.
  $element->value->setProperty('form_group', FALSE);

  if (isset($element->format)) {
    $element->format->addClass(['filter-wrapper', 'form-inline']);

    // Guidelines (removed).
    $element->format->guidelines->setProperty('access', FALSE)
      ->addClass('filter-guidelines');

    // Format (select).
    $element->format->format
      ->addClass(['filter-list', 'input-sm'])
      ->setProperty('title_display', 'invisible')
      ->setProperty('weight', -10);

    // Help (link).
    $element->format->help->addClass('filter-help');
    $element->format->help->about
      ->setAttribute('title', t('Opens in new window'))
      ->setProperty('icon', Bootstrap::glyphicon('question-sign'));

    if (Bootstrap::getTheme()->getSetting('tooltip_enabled')) {
      $element->format->help->about->setAttribute('data-toggle', 'tooltip');
    }
  }
}