EntitySubmenuBlock.php in Entity Submenu Block 8
File
src/Plugin/Derivative/EntitySubmenuBlock.php
View source
<?php
namespace Drupal\entity_submenu_block\Plugin\Derivative;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\system\Plugin\Derivative\SystemMenuBlock;
class EntitySubmenuBlock extends SystemMenuBlock {
use StringTranslationTrait;
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
->t('Entity Submenu Block') . ')';
$this->derivatives[$menu]['config_dependencies']['config'] = array(
$entity
->getConfigDependencyName(),
);
}
return $this->derivatives;
}
}