You are here

public function XBBCodeTestPlugin::prepare in Extensible BBCode 8.3

Same name and namespace in other branches
  1. 4.0.x tests/xbbcode_test_plugin/src/Plugin/XBBCode/XBBCodeTestPlugin.php \Drupal\xbbcode_test_plugin\Plugin\XBBCode\XBBCodeTestPlugin::prepare()

Transform an elements' content, to armor against other filters.

  • Use the inner content if all children will be rendered. (This just means the children's own ::prepare() functions are used.)
  • Use $tag->getSource() if no children will be rendered.
  • Traverse the tag's descendants for more complex cases.

Parameters

string $content: The content, after applying inner transformations.

\Drupal\xbbcode\Parser\Tree\TagElementInterface $tag: The original tag element.

Return value

string The prepared output.

Overrides TagPluginBase::prepare

File

tests/xbbcode_test_plugin/src/Plugin/XBBCode/XBBCodeTestPlugin.php, line 42

Class

XBBCodeTestPlugin
Renders a test tag.

Namespace

Drupal\xbbcode_test_plugin\Plugin\XBBCode

Code

public function prepare(string $content, TagElementInterface $tag) : string {
  return "{prepared:{$content}}";
}