public static function XBBCodeParser::decorateTree in Extensible BBCode 8.3
Same name and namespace in other branches
- 4.0.x src/Parser/XBBCodeParser.php \Drupal\xbbcode\Parser\XBBCodeParser::decorateTree()
Assign processors to the tag elements of a tree.
Parameters
\Drupal\xbbcode\Parser\Tree\NodeElementInterface $node: The tree to decorate.
\Drupal\xbbcode\Parser\Processor\TagProcessorInterface[]|\ArrayAccess $processors: The processors, keyed by name.
1 call to XBBCodeParser::decorateTree()
- XBBCodeParser::parse in src/
Parser/ XBBCodeParser.php - Parse a text and build an element tree.
File
- src/
Parser/ XBBCodeParser.php, line 282
Class
- XBBCodeParser
- The standard XBBCode parser.
Namespace
Drupal\xbbcode\ParserCode
public static function decorateTree(NodeElementInterface $node, $processors) : void {
foreach ($node
->getChildren() as $child) {
if ($child instanceof TagElementInterface) {
$child
->setParent($node);
if ($processor = $processors[$child
->getName()]) {
$child
->setProcessor($processor);
}
static::decorateTree($child, $processors);
}
}
}