You are here

public function TagElement::getOuterSource in Extensible BBCode 4.0.x

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

Retrieve the content including the opening and closing tags.

Tags inside the content will still be rendered.

@todo Use string|Stringable in PHP 8.

Return value

mixed The tag source. Must be a string or a stringable object.

Overrides TagElementInterface::getOuterSource

File

src/Parser/Tree/TagElement.php, line 198

Class

TagElement
A BBCode tag element.

Namespace

Drupal\xbbcode\Parser\Tree

Code

public function getOuterSource() : string {

  // Reconstruct the opening and closing tags, but render the content.
  if (!isset($this->outerSource)) {
    $content = $this
      ->getContent();
    $this->outerSource = "[{$this->openingName}{$this->argument}]{$content}[/{$this->closingName}]";
  }
  return $this->outerSource;
}