class SettingsCommand implements CommandInterface (View source)

AJAX command for adjusting Drupal's JavaScript settings.

The 'settings' command instructs the client either to use the given array as the settings for ajax-loaded content or to extend drupalSettings with the given array, depending on the value of the $merge parameter.

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

Properties

protected array $settings

An array of key/value pairs of JavaScript settings.

protected bool $merge

Whether the settings should be merged into the global drupalSettings.

Methods

__construct(array $settings, bool $merge = FALSE)

Constructs a SettingsCommand object.

render()

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

Details

__construct(array $settings, bool $merge = FALSE)

Constructs a SettingsCommand object.

Parameters

array $settings

An array of key/value pairs of JavaScript settings.

bool $merge

Whether the settings should be merged into the global drupalSettings.

render()

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