class SystemMenuBlock

Same name in this branch

Provides a 'System Menu' block.

Plugin annotation


@Plugin(
  id = "system_menu_block",
  admin_label = @Translation("System Menu"),
  module = "system",
  derivative = "Drupal\system\Plugin\Derivative\SystemMenuBlock"
)

Hierarchy

Expanded class hierarchy of SystemMenuBlock

2 files declare their use of SystemMenuBlock
MenuBlock.php in drupal/core/modules/menu/lib/Drupal/menu/Plugin/Block/MenuBlock.php
Contains \Drupal\menu\Plugin\Block\MenuBlock.
system.module in drupal/core/modules/system/system.module
Configuration system that lets administrators modify the workings of the site.

File

drupal/core/modules/system/lib/Drupal/system/Plugin/Block/SystemMenuBlock.php, line 24
Contains \Drupal\system\Plugin\Block\SystemMenuBlock.

Namespace

Drupal\system\Plugin\Block
View source
class SystemMenuBlock extends BlockBase {

  /**
   * Overrides \Drupal\block\BlockBase::access().
   */
  public function access() {

    // @todo The 'Tools' menu should be available to anonymous users.
    list($plugin, $derivative) = explode(':', $this
      ->getPluginId());
    return $GLOBALS['user']->uid || in_array($derivative, array(
      'menu-main',
      'menu-tools',
      'menu-footer',
    ));
  }

  /**
   * {@inheritdoc}
   */
  public function build() {
    list($plugin, $derivative) = explode(':', $this
      ->getPluginId());

    // Derivatives are prefixed with 'menu-'.
    $menu = substr($derivative, 5);
    return menu_tree($menu);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlockBase::blockForm public function Returns the configuration form elements specific to this block plugin. 11
BlockBase::blockSubmit public function Adds block type-specific submission handling for the block form. 11
BlockBase::blockValidate public function Adds block type-specific validation for the block form.
BlockBase::form public function Implements \Drupal\block\BlockPluginInterface::form(). Overrides BlockPluginInterface::form 1
BlockBase::getConfig public function Returns the configuration data for the block plugin.
BlockBase::setConfig public function Sets a particular value in the block settings.
BlockBase::settings public function Returns plugin-specific settings for the block. Overrides BlockPluginInterface::settings 13
BlockBase::submit public function Implements \Drupal\block\BlockPluginInterface::submit(). Overrides BlockPluginInterface::submit
BlockBase::validate public function Implements \Drupal\block\BlockPluginInterface::validate(). Overrides BlockPluginInterface::validate
BlockBase::__construct public function Constructs a Drupal\Component\Plugin\PluginBase object. Overrides PluginBase::__construct 1
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition.
PluginBase::$pluginId protected property The plugin_id.
PluginBase::getPluginDefinition public function Returns the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition
PluginBase::getPluginId public function Returns the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
SystemMenuBlock::access public function Overrides \Drupal\block\BlockBase::access(). Overrides BlockBase::access
SystemMenuBlock::build public function Builds and returns the renderable array for this block plugin. Overrides BlockPluginInterface::build 1