diff --git a/opencase.links.menu.yml b/opencase.links.menu.yml index 6e89494..3eb8ffc 100644 --- a/opencase.links.menu.yml +++ b/opencase.links.menu.yml @@ -2,7 +2,12 @@ opencase.see_all: title: 'See all...' menu_name: opencase route_name: opencase.opencase_cases_menu - weight: 0 + weight: +opencase.see_all_people_links: + class: Drupal\opencase\Plugin\Menu\SeeAllActorsMenuLink + deriver: Drupal\opencase\Plugin\Derivative\SeeAllActorsMenuLink + menu_name: opencase + parent: opencase.see_all opencase.opencase_add_new_things_menu: title: 'Add new...' menu_name: opencase diff --git a/src/Plugin/Derivative/SeeAllActorsMenuLink.php b/src/Plugin/Derivative/SeeAllActorsMenuLink.php new file mode 100644 index 0000000..64b838a --- /dev/null +++ b/src/Plugin/Derivative/SeeAllActorsMenuLink.php @@ -0,0 +1,55 @@ +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 = []; + $actorTypes = $this->entityTypeManager->getStorage('oc_actor_type')->loadMultiple(); + foreach ($actorTypes as $id => $actorType) { + $links[$id] = [ + 'title' => $actorType->label(), + 'route_name' => "view.actors.page_1", + 'route_parameters' => ['type' => $actorType->id()] + ] + $base_plugin_definition; + } + return $links; + } +} diff --git a/src/Plugin/Menu/SeeAllActorsMenuLink.php b/src/Plugin/Menu/SeeAllActorsMenuLink.php new file mode 100644 index 0000000..13f0e52 --- /dev/null +++ b/src/Plugin/Menu/SeeAllActorsMenuLink.php @@ -0,0 +1,9 @@ +