class WorkbenchToolbar in Workbench 8
Generates the toolbar elements for Workbench.
Hierarchy
- class \Drupal\workbench\Render\Element\WorkbenchToolbar implements TrustedCallbackInterface
 
Expanded class hierarchy of WorkbenchToolbar
1 file declares its use of WorkbenchToolbar
- workbench.module in ./
workbench.module  - Workbench module file.
 
File
- src/
Render/ Element/ WorkbenchToolbar.php, line 11  
Namespace
Drupal\workbench\Render\ElementView source
class WorkbenchToolbar implements TrustedCallbackInterface {
  /**
   * {@inheritdoc}
   */
  public static function trustedCallbacks() {
    return [
      'preRenderTray',
    ];
  }
  /**
   * Render the Workbench toolbar tray.
   *
   * @param array $element
   *   The tray render array.
   *
   * @return array
   *   The tray render array with the Workbench items added.
   *
   * @see toolbar_prerender_toolbar_administration_tray()
   * @see drupal_render()
   */
  public static function preRenderTray(array $element) {
    $menu_tree = \Drupal::service('toolbar.menu_tree');
    $parameters = new MenuTreeParameters();
    $parameters
      ->setMinDepth(1)
      ->setMaxDepth(1);
    $tree = $menu_tree
      ->load('workbench', $parameters);
    $manipulators = [
      [
        'callable' => 'menu.default_tree_manipulators:checkAccess',
      ],
      [
        'callable' => 'menu.default_tree_manipulators:generateIndexAndSort',
      ],
      [
        'callable' => 'toolbar_menu_navigation_links',
      ],
    ];
    $tree = $menu_tree
      ->transform($tree, $manipulators);
    $element['administration_menu'] = $menu_tree
      ->build($tree);
    return $element;
  }
}Members
| 
            Name | 
                  Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| 
            TrustedCallbackInterface:: | 
                  constant | Untrusted callbacks throw exceptions. | ||
| 
            TrustedCallbackInterface:: | 
                  constant | Untrusted callbacks trigger silenced E_USER_DEPRECATION errors. | ||
| 
            TrustedCallbackInterface:: | 
                  constant | Untrusted callbacks trigger E_USER_WARNING errors. | ||
| 
            WorkbenchToolbar:: | 
                  public static | function | Render the Workbench toolbar tray. | |
| 
            WorkbenchToolbar:: | 
                  public static | function | 
            Lists the trusted callbacks provided by the implementing class. Overrides TrustedCallbackInterface:: |