class UltimenuBlock in Ultimenu 8
Same name in this branch
- 8 src/Plugin/Derivative/UltimenuBlock.php \Drupal\ultimenu\Plugin\Derivative\UltimenuBlock
- 8 src/Plugin/Block/UltimenuBlock.php \Drupal\ultimenu\Plugin\Block\UltimenuBlock
Same name and namespace in other branches
- 8.2 src/Plugin/Derivative/UltimenuBlock.php \Drupal\ultimenu\Plugin\Derivative\UltimenuBlock
Provides block plugin definitions for Ultimenu.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\ultimenu\Plugin\Derivative\UltimenuBlock implements ContainerDeriverInterface
Expanded class hierarchy of UltimenuBlock
See also
\Drupal\ultimenu\Plugin\Block\UltimenuBlock
File
- src/
Plugin/ Derivative/ UltimenuBlock.php, line 15
Namespace
Drupal\ultimenu\Plugin\DerivativeView source
class UltimenuBlock extends DeriverBase implements ContainerDeriverInterface {
/**
* The Plugin service.
*
* @var \Drupal\ultimenu\UltimenuManagerInterface
*/
protected $ultimenuManager;
/**
* Constructs a new UltimenuBlock.
*
* @param \Drupal\ultimenu\UltimenuManagerInterface $ultimenu_manager
* The ultimenu manager.
*/
public function __construct(UltimenuManagerInterface $ultimenu_manager) {
$this->ultimenuManager = $ultimenu_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('ultimenu.manager'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
// Provide a block plugin definition for each ultimenu.
foreach ($this->ultimenuManager
->getUltimenuBlocks() as $key => $name) {
$menu_key = 'ultimenu-' . $key;
$this->derivatives[$menu_key] = $base_plugin_definition;
$this->derivatives[$menu_key]['admin_label'] = t("Ultimenu: @name", array(
'@name' => $name,
));
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
UltimenuBlock:: |
protected | property | The Plugin service. | |
UltimenuBlock:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
UltimenuBlock:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
UltimenuBlock:: |
public | function | Constructs a new UltimenuBlock. |