You are here

public static function TextFormat::processElement in Express 8

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

See also

\Drupal\bootstrap\Plugin\Process\ProcessBase::process()

\Drupal\bootstrap\Plugin\Alter\ElementInfo::alter()

File

themes/contrib/bootstrap/src/Plugin/Process/TextFormat.php, line 28
Contains \Drupal\bootstrap\Plugin\Process\TextFormat.

Class

TextFormat
Processes the "text_format" element.

Namespace

Drupal\bootstrap\Plugin\Process

Code

public static function processElement(Element $element, FormStateInterface $form_state, array &$complete_form) {
  if (isset($element->format)) {
    $element->format
      ->addClass('form-inline');

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

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

    // Help (link).
    $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');
    }
  }
}