public function TagPluginBase::process in Extensible BBCode 4.0.x
Same name and namespace in other branches
- 8.3 src/Plugin/TagPluginBase.php \Drupal\xbbcode\Plugin\TagPluginBase::process()
Generate output from a tag element.
@todo Add covariant type hints after PHP 7.4 is required.
Parameters
\Drupal\xbbcode\Parser\Tree\TagElementInterface $tag: The tag element to process.
Return value
\Drupal\xbbcode\Parser\Tree\OutputElementInterface Actually a TagProcessResult, but PHP does not support covariant types.
Overrides TagPluginInterface::process
See also
\Drupal\xbbcode\TagProcessResult
File
- src/
Plugin/ TagPluginBase.php, line 165
Class
- TagPluginBase
- Provides a base class for XBBCode tag plugins.
Namespace
Drupal\xbbcode\PluginCode
public function process(TagElementInterface $tag) : OutputElementInterface {
// Use an adapter that marks rendered output as safe.
$result = $this
->doProcess(new PreparedTagElement($tag));
// Merge metadata from rendered sub-tags.
foreach ($tag
->getRenderedChildren(FALSE) as $child) {
if ($child instanceof TagProcessResult) {
$result = $result
->merge($child);
}
}
return $result;
}