SystemMenuBlock.php 608 Bytes
Newer Older
1
2
3
4
<?php

/**
 * @file
5
 * Contains \Drupal\system\Plugin\Block\SystemMenuBlock.
6
7
 */

8
namespace Drupal\system\Plugin\Block;
9
10

use Drupal\block\BlockBase;
11
use Drupal\Core\Session\AccountInterface;
12
13

/**
14
 * Provides a generic Menu block.
15
 *
16
 * @Block(
17
 *   id = "system_menu_block",
18
 *   admin_label = @Translation("Menu"),
19
 *   category = @Translation("Menus"),
20
21
22
23
24
25
 *   derivative = "Drupal\system\Plugin\Derivative\SystemMenuBlock"
 * )
 */
class SystemMenuBlock extends BlockBase {

  /**
26
   * {@inheritdoc}
27
   */
28
  public function build() {
29
    $menu = $this->getDerivativeId();
30
31
32
33
    return menu_tree($menu);
  }

}