class DataCommand implements CommandInterface (View source)

An AJAX command for implementing jQuery's data() method.

This instructs the client to attach the name=value pair of data to the selector via jQuery's data cache.

This command is implemented by Drupal.AjaxCommands.prototype.data() defined in misc/ajax.js.

Properties

protected string $selector

A CSS selector string for elements to which data will be attached.

protected string $name

The key of the data attached to elements matched by the selector.

protected mixed $value

The value of the data to be attached to elements matched by the selector.

Methods

__construct(string $selector, string $name, mixed $value)

Constructs a DataCommand object.

render()

Implements Drupal\Core\Ajax\CommandInterface:render().

Details

__construct(string $selector, string $name, mixed $value)

Constructs a DataCommand object.

Parameters

string $selector

A CSS selector for the elements to which the data will be attached.

string $name

The key of the data to be attached to elements matched by the selector.

mixed $value

The value of the data to be attached to elements matched by the selector.

render()

Implements Drupal\Core\Ajax\CommandInterface:render().