You are here

public function NodeElement::getRenderedChildren in Extensible BBCode 4.0.x

Same name and namespace in other branches
  1. 8.3 src/Parser/Tree/NodeElement.php \Drupal\xbbcode\Parser\Tree\NodeElement::getRenderedChildren()

Retrieve the rendered output of each child.

Parameters

bool $force_render: (Optional) Set to FALSE to only return output that is already rendered. By default, this method renders it implicitly.

Return value

\Drupal\xbbcode\Parser\Tree\OutputElementInterface[] The sequence of rendered outputs.

Overrides NodeElementInterface::getRenderedChildren

1 call to NodeElement::getRenderedChildren()
NodeElement::getContent in src/Parser/Tree/NodeElement.php
Retrieve the rendered content of the element.

File

src/Parser/Tree/NodeElement.php, line 48

Class

NodeElement
A node element contains other elements.

Namespace

Drupal\xbbcode\Parser\Tree

Code

public function getRenderedChildren($force_render = TRUE) : array {
  if (!$force_render) {
    return $this->output ?? [];
  }
  if ($this->output === NULL) {
    $this->output = [];
    foreach ($this->children as $child) {
      $this->output[] = $child
        ->render();
    }
  }
  return $this->output;
}