You are here

public static function FormTrait::addDataAttribute in Markdown 8.2

Adds a data attribute to an element.

Parameters

array $element: An element, passed by reference.

string $name: The name of the data attribute.

mixed $value: The value of the data attribute. Note: do not JSON encode this value.

File

src/Traits/FormTrait.php, line 65

Class

FormTrait
Trait providing helpful methods when dealing with forms.

Namespace

Drupal\markdown\Traits

Code

public static function addDataAttribute(array &$element, $name, $value) {
  static::addDataAttributes($element, [
    $name => $value,
  ]);
}