You are here

public function FilterHtml::process in Panopoly WYSIWYG 8.2

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 FilterHtml::process

See also

\Drupal\filter\FilterProcessResult

File

src/Plugin/Filter/FilterHtml.php, line 18

Class

FilterHtml
Replacement for core FilterHtml that respects <!--break-->.

Namespace

Drupal\panopoly_wysiwyg\Plugin\Filter

Code

public function process($text, $langcode) {

  // Split the text on <!--break-->, then do the normal processing and
  // re-join.
  $parts = explode('<!--break-->', $text, 2);
  foreach ($parts as &$part) {
    $part = parent::process($part, $langcode)
      ->getProcessedText();
  }
  $text = count($parts) > 1 ? implode('<!--break-->', $parts) : $parts[0];
  return new FilterProcessResult($text);
}