3 namespace Drupal\Plugin\Core
;
4 use Drupal\Plugin\PluginChildrenInterface
;
8 * System module block for rendering system menus from the
9 * menu_list_system_menus() funtion.
11 class SystemMenuBlock
extends AbstractBlock implements PluginChildrenInterface
{
16 * Implements AccessInterface::access().
18 public
function access() {
23 return parent
::access();
27 * Implements PluginChildrenInterface::getChild().
29 public
function getChild($child) {
30 $this->child
= $child;
31 if (!isset($this->children
[$child])) {
34 if(isset($this->children
[$child])) {
35 $this->config
= $this->children
[$child];
36 return $this->children
[$child];
42 * Implements PluginChildrenInterface::getChildren().
44 public
function getChildren() {
45 foreach (menu_list_system_menus() as
$menu => $name) {
46 $this->children
[$menu] = clone($this->config
);
47 $this->children
[$menu]->delta
= $menu;
48 $this->children
[$menu]->subject
= $name;
50 return $this->children
;
54 * Implements BlockInterface::info().
56 public
function info() {
57 $args = func_get_args();
58 $child = $this->getChild($args[0]);
61 'info' => $child->subject
,
62 'cache' => DRUPAL_NO_CACHE
,
66 'info' => 'Menu Block',
67 'cache' => DRUPAL_NO_CACHE
,
72 * Implements BlockInterface::build().
74 public
function build() {
76 '#block' => $this->children
[$this->child
],
77 menu_tree($this->child
),