class JumpMenuBlock in Better Jump Menus 8
Same name in this branch
- 8 lib/Drupal/jump_menu/Plugin/Derivative/JumpMenuBlock.php \Drupal\jump_menu\Plugin\Derivative\JumpMenuBlock
- 8 lib/Drupal/jump_menu/Plugin/Block/JumpMenuBlock.php \Drupal\jump_menu\Plugin\Block\JumpMenuBlock
Provides jump menu block plugin definitions for custom menus.
Hierarchy
- class \Drupal\jump_menu\Plugin\Derivative\JumpMenuBlock extends \Drupal\Component\Plugin\Derivative\DerivativeBase implements \Drupal\Core\Plugin\Discovery\ContainerDerivativeInterface
Expanded class hierarchy of JumpMenuBlock
See also
\Drupal\jump_menu\Plugin\Block\JumpMenuBlock
File
- lib/
Drupal/ jump_menu/ Plugin/ Derivative/ JumpMenuBlock.php, line 20 - Contains \Drupal\jump_menu\Plugin\Derivative\JumpMenuBlock.
Namespace
Drupal\jump_menu\Plugin\DerivativeView source
class JumpMenuBlock extends DerivativeBase implements ContainerDerivativeInterface {
/**
* The menu storage.
*
* @var \Drupal\Core\Entity\EntityStorageControllerInterface
*/
protected $menuStorage;
/**
* Constructs new JumpMenuBlock.
*
* @param \Drupal\Core\Entity\EntityStorageControllerInterface $menu_storage
* The menu storage.
*/
public function __construct(EntityStorageControllerInterface $menu_storage) {
$this->menuStorage = $menu_storage;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('entity.manager')
->getStorageController('menu'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions(array $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]['cache'] = DRUPAL_NO_CACHE;
}
return $this->derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
JumpMenuBlock:: |
protected | property | The menu storage. | |
JumpMenuBlock:: |
public static | function | ||
JumpMenuBlock:: |
public | function | ||
JumpMenuBlock:: |
public | function | Constructs new JumpMenuBlock. |