From 55f34cb4d735abb1bb9d6c8bd67d15420feb3596 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 15 Apr 2022 16:29:26 +0200 Subject: [PATCH] Added the seeAllEvents but it is not workgin do to a bug I can't seem to fin --- opencase.links.menu.yml | 5 ++ .../Derivative/SeeAllEventsMenuLink.php | 60 +++++++++++++++++++ src/Plugin/Menu/SeeAllEventsMenuLink.php | 9 +++ 3 files changed, 74 insertions(+) create mode 100644 src/Plugin/Derivative/SeeAllEventsMenuLink.php create mode 100644 src/Plugin/Menu/SeeAllEventsMenuLink.php diff --git a/opencase.links.menu.yml b/opencase.links.menu.yml index ef8ceea..11eed02 100644 --- a/opencase.links.menu.yml +++ b/opencase.links.menu.yml @@ -13,6 +13,11 @@ opencase.see_all_organisations_links: deriver: Drupal\opencase\Plugin\Derivative\SeeAllOrganisationsMenuLink menu_name: opencase parent: opencase.see_all +opencase.see_all_events_links: + class: Drupal\opencase\Plugin\Menu\SeeAllEventsMenuLink + deriver: Drupal\opencase\Plugin\Derivative\SeeAllEventsMenuLink + 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/SeeAllEventsMenuLink.php b/src/Plugin/Derivative/SeeAllEventsMenuLink.php new file mode 100644 index 0000000..74885d7 --- /dev/null +++ b/src/Plugin/Derivative/SeeAllEventsMenuLink.php @@ -0,0 +1,60 @@ +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 = []; + $eventTypes = $this->entityTypeManager->getStorage('oc_event_type')->loadMultiple(); + foreach ($eventTypes as $id => $eventType) { + $links[$id] = [ + 'title' => $eventType->label(), + 'route_name' => "view.actors.page_1", //@TODO findout why "view.events.page_1" does not work + 'route_parameters' => ['type' => $eventType->id()] + ] + $base_plugin_definition; + } + return $links; + } +} diff --git a/src/Plugin/Menu/SeeAllEventsMenuLink.php b/src/Plugin/Menu/SeeAllEventsMenuLink.php new file mode 100644 index 0000000..f0e01ce --- /dev/null +++ b/src/Plugin/Menu/SeeAllEventsMenuLink.php @@ -0,0 +1,9 @@ +