public function PreparedTagElement::getOuterSource in Extensible BBCode 4.0.x
Same name and namespace in other branches
- 8.3 src/PreparedTagElement.php \Drupal\xbbcode\PreparedTagElement::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/
PreparedTagElement.php, line 150
Class
- PreparedTagElement
- Adapter for the tag element that marks markup as safe.
Namespace
Drupal\xbbcodeCode
public function getOuterSource() {
// Reconstruct the opening and closing tags, but render the content.
if (!isset($this->outerSource)) {
// The argument string must be made safe before rendering.
$argument = XssEscape::filterAdmin($this->tag
->getArgument());
$content = $this->tag
->getContent();
$this->outerSource = Markup::create("[{$this->getOpeningName()}{$argument}]{$content}[/{$this->getClosingName()}]");
}
return $this->outerSource;
}