class SystemMenuBlock
Provides block plugin definitions for custom menus.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements \Drupal\Component\Plugin\Derivative\DeriverInterface
- class \Drupal\system\Plugin\Derivative\SystemMenuBlock implements \Drupal\Core\Plugin\Discovery\ContainerDeriverInterface extends \Drupal\Component\Plugin\Derivative\DeriverBase
 
 
Expanded class hierarchy of SystemMenuBlock
See also
\Drupal\system\Plugin\Block\SystemMenuBlock
1 file declares its use of SystemMenuBlock
- SystemMenuBlock.php in core/
modules/ system/ src/ Plugin/ Block/ SystemMenuBlock.php  
File
- 
              core/
modules/ system/ src/ Plugin/ Derivative/ SystemMenuBlock.php, line 15  
Namespace
Drupal\system\Plugin\DerivativeView source
class SystemMenuBlock extends DeriverBase implements ContainerDeriverInterface {
  
  /**
   * The menu storage.
   *
   * @var \Drupal\Core\Entity\EntityStorageInterface
   */
  protected $menuStorage;
  
  /**
   * Constructs new SystemMenuBlock.
   *
   * @param \Drupal\Core\Entity\EntityStorageInterface $menu_storage
   *   The menu storage.
   */
  public function __construct(EntityStorageInterface $menu_storage) {
    $this->menuStorage = $menu_storage;
  }
  
  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, $base_plugin_id) {
    return new static($container->get('entity_type.manager')
      ->getStorage('menu'));
  }
  
  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinitions($base_plugin_definition) {
    foreach ($this->menuStorage
      ->loadMultiple() as $menu => $entity) {
      $this->derivatives[$menu] = $base_plugin_definition;
      $this->derivatives[$menu]['admin_label'] = $entity->label();
      $this->derivatives[$menu]['config_dependencies']['config'] = [
        $entity->getConfigDependencyName(),
      ];
    }
    return $this->derivatives;
  }
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides | 
|---|---|---|---|---|---|
| DeriverBase::$derivatives | protected | property | List of derivative definitions. | 1 | |
| DeriverBase::getDerivativeDefinition | public | function | Gets the definition of a derivative plugin. | Overrides DeriverInterface::getDerivativeDefinition | |
| SystemMenuBlock::$menuStorage | protected | property | The menu storage. | ||
| SystemMenuBlock::create | public static | function | Creates a new class instance. | Overrides ContainerDeriverInterface::create | |
| SystemMenuBlock::getDerivativeDefinitions | public | function | Gets the definition of all derivatives of a base plugin. | Overrides DeriverBase::getDerivativeDefinitions | |
| SystemMenuBlock::__construct | public | function | Constructs new SystemMenuBlock. | 
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.