class TextFormat

Processes the "text_format" element.

@BootstrapProcess("text_format")

Hierarchy

Expanded class hierarchy of TextFormat

See Also

  • \Drupal\filter\Element\TextFormat::processFormat()

Related topics

Namespace

Drupal\bootstrap\Plugin\Process
Source
class TextFormat extends ProcessBase implements ProcessInterface {

  /**
   * {@inheritdoc}
   */
  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('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');
      }
    }
  }

}

Members

Contains filters are case sensitive
Name Modifiers Type Description
PluginBase::$theme protected property The currently set theme object.
PluginBase::__construct public function
ProcessBase::process public static function Process a specific form element type. Overrides ProcessInterface::process
TextFormat::processElement public static function Process a specific form element. Overrides ProcessBase::processElement