You are here

public function TagElement::setAttribute in Extensible BBCode 8.3

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

Set an attribute of the element.

Parameters

string $name: The name of the attribute.

string|null $value: (Optional) The value of the attribute, or NULL to unset it.

Overrides TagElementInterface::setAttribute

File

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

Class

TagElement
A BBCode tag element.

Namespace

Drupal\xbbcode\Parser\Tree

Code

public function setAttribute(string $name, string $value = NULL) : void {
  $this->attributes[$name] = $value;
  if ($value === NULL) {
    unset($this->attributes[$name]);
  }
}