You are here

public function FilterTemplates::process in Wysiwyg API template plugin 3.0.x

Same name and namespace in other branches
  1. 8.2 modules/wysiwyg_template_core/src/Plugin/Filter/FilterTemplates.php \Drupal\wysiwyg_template_core\Plugin\Filter\FilterTemplates::process()

Performs the filter processing.

Parameters

string $text: The text string to be filtered.

string $langcode: The language code of the text to be filtered.

Return value

\Drupal\filter\FilterProcessResult The filtered text, wrapped in a FilterProcessResult object, and possibly with associated assets, cacheability metadata and placeholders.

Overrides FilterInterface::process

See also

\Drupal\filter\FilterProcessResult

File

modules/wysiwyg_template_core/src/Plugin/Filter/FilterTemplates.php, line 24

Class

FilterTemplates
Provides a filter to remove WYSIWYG-specific markup from rendering.

Namespace

Drupal\wysiwyg_template_core\Plugin\Filter

Code

public function process($text, $langcode) : FilterProcessResult {

  // @todo While this was how the filter worked in 7.x, this should be ported
  // to use the attribute filtering logic in core.
  // @see \Drupal\filter\Plugin\Filter\FilterHtml
  $text = str_replace([
    'contenteditable="true"',
    'contenteditable="false"',
  ], '', $text);
  return new FilterProcessResult($text);
}