class AddAssetsCommand in Content-Security-Policy 8
AJAX command for including additional assets.
The 'add_assets' command instructs the client to load additional JS and CSS.
This command is implemented by Drupal.AjaxCommands.prototype.add_assets() defined in csp_extras/js/ajax.js.
Hierarchy
- class \Drupal\csp_extras\Ajax\AddAssetsCommand implements CommandInterface
Expanded class hierarchy of AddAssetsCommand
File
- csp_extras/
src/ Ajax/ AddAssetsCommand.php, line 17
Namespace
Drupal\csp_extras\AjaxView source
class AddAssetsCommand implements CommandInterface {
/**
* An array of assets keyed by their type (either 'script' or 'style').
*
* @var array[]
*/
protected $assets;
/**
* Constructs a AddAssetsCommand object.
*
* @param array[] $assets
* An array of asset element definitions.
*/
public function __construct(array $assets) {
$this->assets = array_values($assets);
}
/**
* Implements Drupal\Core\Ajax\CommandInterface:render().
*/
public function render() {
return [
'command' => 'add_assets',
'assets' => $this->assets,
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AddAssetsCommand:: |
protected | property | An array of assets keyed by their type (either 'script' or 'style'). | |
AddAssetsCommand:: |
public | function |
Implements Drupal\Core\Ajax\CommandInterface:render(). Overrides CommandInterface:: |
|
AddAssetsCommand:: |
public | function | Constructs a AddAssetsCommand object. |