class SystemMenuNavigationBlock

Same name in other branches
  1. 11.x core/modules/navigation/src/Plugin/Derivative/SystemMenuNavigationBlock.php \Drupal\navigation\Plugin\Derivative\SystemMenuNavigationBlock

Provides navigation block plugin definitions for custom menus.

@internal

Hierarchy

Expanded class hierarchy of SystemMenuNavigationBlock

See also

\Drupal\navigation\Plugin\Block\NavigationMenuBlock

1 file declares its use of SystemMenuNavigationBlock
NavigationMenuBlock.php in core/modules/navigation/src/Plugin/Block/NavigationMenuBlock.php

File

core/modules/navigation/src/Plugin/Derivative/SystemMenuNavigationBlock.php, line 18

Namespace

Drupal\navigation\Plugin\Derivative
View source
final class SystemMenuNavigationBlock extends DeriverBase implements ContainerDeriverInterface {
    
    /**
     * Constructs new SystemMenuNavigationBlock.
     *
     * @param \Drupal\Core\Entity\EntityStorageInterface $menuStorage
     *   The menu storage.
     */
    public function __construct(EntityStorageInterface $menuStorage) {
    }
    
    /**
     * {@inheritdoc}
     */
    public static function create(ContainerInterface $container, $base_plugin_id) : static {
        return new static($container->get('entity_type.manager')
            ->getStorage('menu'));
    }
    
    /**
     * {@inheritdoc}
     */
    public function getDerivativeDefinitions($base_plugin_definition) : array {
        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
SystemMenuNavigationBlock::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create
SystemMenuNavigationBlock::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. Overrides DeriverBase::getDerivativeDefinitions
SystemMenuNavigationBlock::__construct public function Constructs new SystemMenuNavigationBlock.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.