abstract class AttributeValueBase (View source)

Defines the base class for an attribute type.

Constants

RENDER_EMPTY_ATTRIBUTE

Renders '$name=""' if $value is an empty string.

Properties

protected mixed $value

The value itself.

protected mixed $name

The name of the value.

Methods

__construct($name, $value)

Constructs a \Drupal\Core\Template\AttributeValueBase object.

string
render()

Returns a string representation of the attribute.

value()

Returns the raw value.

__toString()

Implements the magic __toString() method.

Details

__construct($name, $value)

Constructs a \Drupal\Core\Template\AttributeValueBase object.

Parameters

$name
$value

string render()

Returns a string representation of the attribute.

While __toString only returns the value in a string form, render() contains the name of the attribute as well.

Return Value

string

The string representation of the attribute.

value()

Returns the raw value.

abstract __toString()

Implements the magic __toString() method.