You are here

public function CommentDelimiterFilter::process in Gutenberg 8

Process each delimiter.

Overrides FilterInterface::process

File

src/Plugin/Filter/CommentDelimiterFilter.php, line 25

Class

CommentDelimiterFilter
Class CommentDelimiterFilter.

Namespace

Drupal\gutenberg\Plugin\Filter

Code

public function process($text, $langcode) {
  $lines = explode("\n", $text);
  $lines = preg_replace_callback('#<!-- \\/?wp:.* \\/?-->#', [
    $this,
    'renderContent',
  ], $lines);
  $text = implode("\n", $lines);
  return new FilterProcessResult($text);
}