Merge branch 'master' into alex
This commit is contained in:
commit
4ab621100f
@ -50,6 +50,11 @@ opencase.opencase_admin_menu:
|
|||||||
route_name: opencase.opencase_admin_menu
|
route_name: opencase.opencase_admin_menu
|
||||||
menu_name: opencase
|
menu_name: opencase
|
||||||
weight: 100
|
weight: 100
|
||||||
|
opencase.manage_taxonomy_links:
|
||||||
|
class: Drupal\opencase\Plugin\Menu\ManageTaxonomyMenuLink
|
||||||
|
deriver: Drupal\opencase\Plugin\Derivative\ManageTaxonomyMenuLink
|
||||||
|
menu_name: opencase
|
||||||
|
parent: opencase.opencase_admin_menu
|
||||||
opencase.manage_user_logins:
|
opencase.manage_user_logins:
|
||||||
title: 'Manage user logins'
|
title: 'Manage user logins'
|
||||||
description: 'Manage who can access the system'
|
description: 'Manage who can access the system'
|
||||||
|
52
src/Plugin/Derivative/ManageTaxonomyMenuLink.php
Normal file
52
src/Plugin/Derivative/ManageTaxonomyMenuLink.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\opencase\Plugin\Derivative;
|
||||||
|
|
||||||
|
use Drupal\Component\Plugin\Derivative\DeriverBase;
|
||||||
|
use Drupal\Core\Plugin\Discovery\ContainerDeriverInterface;
|
||||||
|
use Drupal\Core\Entity\EntityTypeManagerInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||||
|
|
||||||
|
class ManageTaxonomyMenuLink extends DeriverBase implements ContainerDeriverInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var EntityTypeManagerInterface $entityTypeManager.
|
||||||
|
*/
|
||||||
|
|
||||||
|
protected $entityTypeManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a AddEventsMenuLink instance.
|
||||||
|
*
|
||||||
|
* @param $base_plugin_id
|
||||||
|
* @param EntityTypeManagerInterface $entity_type_manager
|
||||||
|
*/
|
||||||
|
public function __construct($base_plugin_id, EntityTypeManagerInterface $entity_type_manager) {
|
||||||
|
$this->entityTypeManager = $entity_type_manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public static function create(ContainerInterface $container, $base_plugin_id) {
|
||||||
|
return new static(
|
||||||
|
$base_plugin_id,
|
||||||
|
$container->get('entity_type.manager')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getDerivativeDefinitions($base_plugin_definition) {
|
||||||
|
$links = [];
|
||||||
|
$vocabs = $this->entityTypeManager->getStorage('taxonomy_vocabulary')->loadMultiple();
|
||||||
|
foreach ($vocabs as $id => $vocab) {
|
||||||
|
$links[$id] = [
|
||||||
|
'title' => 'Manage ' . $vocab->label(),
|
||||||
|
'route_name' => "entity.taxonomy_vocabulary.overview_form",
|
||||||
|
'route_parameters' => ['taxonomy_vocabulary' => $vocab->id()]
|
||||||
|
] + $base_plugin_definition;
|
||||||
|
}
|
||||||
|
return $links;
|
||||||
|
}
|
||||||
|
}
|
6
src/Plugin/Menu/ManageTaxonomyMenuLink.php
Normal file
6
src/Plugin/Menu/ManageTaxonomyMenuLink.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
namespace Drupal\opencase\Plugin\Menu;
|
||||||
|
|
||||||
|
use Drupal\Core\Menu\MenuLinkDefault;
|
||||||
|
|
||||||
|
class ManageTaxonomyMenuLink extends MenuLinkDefault {}
|
Reference in New Issue
Block a user