class SetSubtreesCommand in Drupal 8
Same name and namespace in other branches
- 9 core/modules/toolbar/src/Ajax/SetSubtreesCommand.php \Drupal\toolbar\Ajax\SetSubtreesCommand
Defines an AJAX command that sets the toolbar subtrees.
Hierarchy
- class \Drupal\toolbar\Ajax\SetSubtreesCommand implements CommandInterface
Expanded class hierarchy of SetSubtreesCommand
1 file declares its use of SetSubtreesCommand
- ToolbarController.php in core/
modules/ toolbar/ src/ Controller/ ToolbarController.php
File
- core/
modules/ toolbar/ src/ Ajax/ SetSubtreesCommand.php, line 10
Namespace
Drupal\toolbar\AjaxView source
class SetSubtreesCommand implements CommandInterface {
/**
* The toolbar subtrees.
*
* @var array
*/
protected $subtrees;
/**
* Constructs a SetSubtreesCommand object.
*
* @param array $subtrees
* The toolbar subtrees that will be set.
*/
public function __construct($subtrees) {
$this->subtrees = $subtrees;
}
/**
* {@inheritdoc}
*/
public function render() {
return [
'command' => 'setToolbarSubtrees',
'subtrees' => array_map('strval', $this->subtrees),
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SetSubtreesCommand:: |
protected | property | The toolbar subtrees. | |
SetSubtreesCommand:: |
public | function |
Return an array to be run through json_encode and sent to the client. Overrides CommandInterface:: |
|
SetSubtreesCommand:: |
public | function | Constructs a SetSubtreesCommand object. |