You are here

public function FieldMappingFilter::process in Gutenberg 8

Process each URL.

Overrides FilterInterface::process

File

src/Plugin/Filter/FieldMappingFilter.php, line 56

Class

FieldMappingFilter
Class FieldMappingFilter.

Namespace

Drupal\gutenberg\Plugin\Filter

Code

public function process($text, $langcode) {

  // $lines = explode("\n", $text);
  $text = preg_replace_callback('#((<!-- .*\\{.*"mappingField".*} -->)([\\s\\S]*?)(<!-- \\/[\\s\\S]*?-->)|(<!-- .*\\{.*"mappingField".*} \\/-->))#', [
    $this,
    'renderWithoutMappingFields',
  ], $text);

  // $text = implode("\n", $lines);
  return new FilterProcessResult($text);
}