Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 7
SetSubtreesCommand
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 7
 __construct
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 render
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 5
<?php
/**
 * @file
 * Contains \Drupal\toolbar\Ajax\SetSubtreesCommand.
 */
namespace Drupal\toolbar\Ajax;
use Drupal\Core\Ajax\CommandInterface;
/**
 * Defines an AJAX command that sets the toolbar subtrees.
 */
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),
    ];
  }
}