public static function XBBCodeFilter::addLinebreaks in Extensible BBCode 4.0.x
Same name and namespace in other branches
- 8.3 src/Plugin/Filter/XBBCodeFilter.php \Drupal\xbbcode\Plugin\Filter\XBBCodeFilter::addLinebreaks()
Add linebreaks inside text elements.
Parameters
\Drupal\xbbcode\Parser\Tree\NodeElementInterface $tree: The parse tree.
1 call to XBBCodeFilter::addLinebreaks()
- XBBCodeFilter::process in src/
Plugin/ Filter/ XBBCodeFilter.php - Performs the filter processing.
File
- src/
Plugin/ Filter/ XBBCodeFilter.php, line 336
Class
- XBBCodeFilter
- Provides a filter that converts BBCode to HTML.
Namespace
Drupal\xbbcode\Plugin\FilterCode
public static function addLinebreaks(NodeElementInterface $tree) : void {
foreach ($tree
->getDescendants() as $node) {
if ($node instanceof TextElement) {
$node
->setText(nl2br($node
->getText()));
}
}
}