You are here

interface TagElementInterface in Extensible BBCode 4.0.x

Same name and namespace in other branches
  1. 8.3 src/Parser/Tree/TagElementInterface.php \Drupal\xbbcode\Parser\Tree\TagElementInterface

A tag occurrence as processed by tag plugins.

Hierarchy

Expanded class hierarchy of TagElementInterface

All classes that implement TagElementInterface

18 files declare their use of TagElementInterface
CallbackTagProcessor.php in src/Parser/Processor/CallbackTagProcessor.php
CodeTagPlugin.php in standard/src/Plugin/XBBCode/CodeTagPlugin.php
EntityTagPlugin.php in src/Plugin/XBBCode/EntityTagPlugin.php
ImageTagPlugin.php in standard/src/Plugin/XBBCode/ImageTagPlugin.php
ListTagPlugin.php in standard/src/Plugin/XBBCode/ListTagPlugin.php

... See full list

File

src/Parser/Tree/TagElementInterface.php, line 10

Namespace

Drupal\xbbcode\Parser\Tree
View source
interface TagElementInterface extends NodeElementInterface {

  /**
   * Get the canonical (lower-case) tag name of this element.
   *
   * @return string
   *   The tag name.
   */
  public function getName() : string;

  /**
   * Get the original opening tag name.
   *
   * Case-insensitively equivalent to ::getName() and ::getClosingName().
   *
   * @return string
   *   The opening tag name.
   */
  public function getOpeningName() : string;

  /**
   * Get the original closing tag name.
   *
   * @return string
   *   The closing tag name.
   */
  public function getClosingName() : string;

  /**
   * Get the original closing tag name.
   *
   * @param string $closing
   *   The closing tag name.
   *
   * @return $this
   */
  public function setClosingName(string $closing) : self;

  /**
   * Retrieve the unparsed argument string.
   *
   * @return string
   *   All characters between the tag name and the right square bracket.
   */
  public function getArgument() : string;

  /**
   * Retrieve a particular attribute of the element.
   *
   * [tag NAME=VALUE]...[/tag]
   *
   * @param string $name
   *   The name of the attribute, or NULL.
   *
   * @return string|null
   *   The value of this attribute, or NULL if it isn't set.
   */
  public function getAttribute(string $name) : ?string;

  /**
   * Set an attribute of the element.
   *
   * @param string $name
   *   The name of the attribute.
   * @param string|null $value
   *   (Optional) The value of the attribute, or NULL to unset it.
   */
  public function setAttribute(string $name, string $value = NULL) : void;

  /**
   * Return all attribute values.
   *
   * @return string[]
   *   The tag attributes, indexed by name.
   */
  public function getAttributes() : array;

  /**
   * Set all attribute values.
   *
   * @param string[] $attributes
   *   The tag attributes, indexed by name.
   */
  public function setAttributes(array $attributes) : void;

  /**
   * Retrieve the option-type attribute of the element.
   *
   * [tag=OPTION]...[/tag]
   *
   * @return string
   *   The value of the option.
   */
  public function getOption() : string;

  /**
   * Set the option-style attribute of the element.
   *
   * @param string $value
   *   The value of the option.
   */
  public function setOption(string $value) : void;

  /**
   * Retrieve the content source of the tag.
   *
   * [tag]CONTENT[/tag]
   *
   * This is the content of the tag before rendering.
   *
   * @return mixed
   *   The tag content source. Must be a string or a stringable object.
   *
   * @todo Use string|Stringable in PHP 8.
   */
  public function getSource();

  /**
   * Set the content source of the tag.
   *
   * @param string $source
   *   The text between [tag] and [/tag].
   */
  public function setSource(string $source) : void;

  /**
   * Retrieve the content including the opening and closing tags.
   *
   * Tags inside the content will still be rendered.
   *
   * @return mixed
   *   The tag source. Must be a string or a stringable object.
   *
   * @todo Use string|Stringable in PHP 8.
   */
  public function getOuterSource();

  /**
   * Retrieve the parent of the current tag.
   *
   * This may be either another tag or the root element.
   *
   * Note that the parent's rendered content will obviously be incomplete
   * during rendering, and should not be accessed.
   *
   * @return \Drupal\xbbcode\Parser\Tree\NodeElementInterface
   *   Parent node.
   */
  public function getParent() : NodeElementInterface;

  /**
   * Set the parent of the current tag.
   *
   * @param \Drupal\xbbcode\Parser\Tree\NodeElementInterface $parent
   *   Parent node.
   */
  public function setParent(NodeElementInterface $parent) : void;

  /**
   * Get the assigned processor.
   *
   * @return \Drupal\xbbcode\Parser\Processor\TagProcessorInterface
   *   Tag processor.
   */
  public function getProcessor() : TagProcessorInterface;

  /**
   * Assign a processor to this tag element.
   *
   * @param \Drupal\xbbcode\Parser\Processor\TagProcessorInterface $processor
   *   A tag processor.
   */
  public function setProcessor(TagProcessorInterface $processor) : void;

}

Members

Namesort descending Modifiers Type Description Overrides
ElementInterface::render public function Render this element to a string. 4
NodeElementInterface::append public function Append an element to the children of this element. 2
NodeElementInterface::getChildren public function Get all children of the element. 2
NodeElementInterface::getContent public function Retrieve the rendered content of the element. 2
NodeElementInterface::getDescendants public function Retrieve the descendants of the node. 2
NodeElementInterface::getRenderedChildren public function Retrieve the rendered output of each child. 2
TagElementInterface::getArgument public function Retrieve the unparsed argument string. 2
TagElementInterface::getAttribute public function Retrieve a particular attribute of the element. 2
TagElementInterface::getAttributes public function Return all attribute values. 2
TagElementInterface::getClosingName public function Get the original closing tag name. 2
TagElementInterface::getName public function Get the canonical (lower-case) tag name of this element. 2
TagElementInterface::getOpeningName public function Get the original opening tag name. 2
TagElementInterface::getOption public function Retrieve the option-type attribute of the element. 2
TagElementInterface::getOuterSource public function Retrieve the content including the opening and closing tags. 2
TagElementInterface::getParent public function Retrieve the parent of the current tag. 2
TagElementInterface::getProcessor public function Get the assigned processor. 2
TagElementInterface::getSource public function Retrieve the content source of the tag. 2
TagElementInterface::setAttribute public function Set an attribute of the element. 2
TagElementInterface::setAttributes public function Set all attribute values. 2
TagElementInterface::setClosingName public function Get the original closing tag name. 2
TagElementInterface::setOption public function Set the option-style attribute of the element. 2
TagElementInterface::setParent public function Set the parent of the current tag. 2
TagElementInterface::setProcessor public function Assign a processor to this tag element. 2
TagElementInterface::setSource public function Set the content source of the tag. 2