public function ReusableBlockFilter::process in Gutenberg 8
Process each block.
Overrides FilterInterface::process
File
- src/
Plugin/ Filter/ ReusableBlockFilter.php, line 26
Class
- ReusableBlockFilter
- Class ReusableBlockFilter.
Namespace
Drupal\gutenberg\Plugin\FilterCode
public function process($text, $langcode) {
$lines = explode("\n", $text);
$lines = preg_replace_callback('#<!-- wp:block.*\\s(.*)\\s\\/-->#', [
$this,
'renderBlock',
], $lines);
$text = implode("\n", $lines);
return new FilterProcessResult($text);
}