public function TBMegaMenuBlock::getDerivativeDefinitions in The Better Mega Menu 8
Same name and namespace in other branches
- 2.x src/Plugin/Derivative/TBMegaMenuBlock.php \Drupal\tb_megamenu\Plugin\Derivative\TBMegaMenuBlock::getDerivativeDefinitions()
Gets the definition of all derivatives of a base plugin.
Parameters
array $base_plugin_definition: The definition array of the base plugin.
Return value
array An array of full derivative definitions keyed on derivative id.
Overrides DeriverBase::getDerivativeDefinitions
See also
getDerivativeDefinition()
File
- src/
Plugin/ Derivative/ TBMegaMenuBlock.php, line 55
Class
- TBMegaMenuBlock
- Provides blocks which belong to TB Mega Menu.
Namespace
Drupal\tb_megamenu\Plugin\DerivativeCode
public function getDerivativeDefinitions($base_plugin_definition) {
$menus = $this->entityTypeManager
->getStorage('menu')
->loadMultiple();
asort($menus);
foreach ($this->configFactory
->listAll('tb_megamenu.menu_config.') as $index_id) {
$info = $this->configFactory
->get($index_id);
$menu = $info
->get('menu');
if (isset($menus[$menu])) {
$this->derivatives[$menu] = $base_plugin_definition;
$this->derivatives[$menu]['admin_label'] = $menus[$menu]
->label();
}
}
return $this->derivatives;
}