From 66f95f46bf818791a8c9ad9cdaa807af308189d3 Mon Sep 17 00:00:00 2001 From: Nick Date: Fri, 8 Apr 2022 13:20:01 +0200 Subject: [PATCH] mob next [ci-skip] [ci skip] [skip ci] lastFile:src/Plugin/Derivative/SeeAllOrganisationsMenuLink.php --- opencase.links.menu.yml | 29 ++++++---- .../SeeAllOrganisationsMenuLink.php | 55 +++++++++++++++++++ .../Menu/SeeAllOrganisationsMenuLink.php | 9 +++ 3 files changed, 81 insertions(+), 12 deletions(-) create mode 100644 src/Plugin/Derivative/SeeAllOrganisationsMenuLink.php create mode 100644 src/Plugin/Menu/SeeAllOrganisationsMenuLink.php diff --git a/opencase.links.menu.yml b/opencase.links.menu.yml index 3eb8ffc..ef8ceea 100644 --- a/opencase.links.menu.yml +++ b/opencase.links.menu.yml @@ -1,16 +1,21 @@ opencase.see_all: title: 'See all...' - menu_name: opencase + menu_name: opencase route_name: opencase.opencase_cases_menu - weight: + 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.see_all_organisations_links: + class: Drupal\opencase\Plugin\Menu\SeeAllOrganisationsMenuLink + deriver: Drupal\opencase\Plugin\Derivative\SeeAllOrganisationsMenuLink + menu_name: opencase + parent: opencase.see_all opencase.opencase_add_new_things_menu: title: 'Add new...' - menu_name: opencase + menu_name: opencase route_name: opencase.opencase_add_new_things_menu weight: 1 opencase.add_people_links: @@ -38,59 +43,59 @@ opencase.opencase_admin_menu: title: 'Administration' description: 'Management and Configuration' route_name: opencase.opencase_admin_menu - menu_name: opencase + menu_name: opencase weight: 100 opencase.manage_user_logins: title: 'Manage user logins' description: 'Manage who can access the system' menu_name: opencase - parent: opencase.opencase_admin_menu + parent: opencase.opencase_admin_menu url: internal:/admin/people weight: 0 opencase.manage_organisation_types: title: 'Manage organisation types' description: 'Configure types of people and their fields' menu_name: opencase - parent: opencase.opencase_admin_menu + parent: opencase.opencase_admin_menu url: internal:/admin/opencase/oc_organisation_type weight: 1 opencase.manage_person_types: title: 'Manage person types' description: 'Configure types of people and their fields' menu_name: opencase - parent: opencase.opencase_admin_menu + parent: opencase.opencase_admin_menu url: internal:/admin/opencase/oc_actor_type weight: 1 opencase.manage_activity_types: title: 'Manage activity types' description: 'Configure types of activities and their fields' menu_name: opencase - parent: opencase.opencase_admin_menu + parent: opencase.opencase_admin_menu url: internal:/admin/opencase/oc_activity_type weight: 3 opencase.manage_case_fee_types: title: 'Manage case fee types' description: 'Configure types of case fees and their fields' menu_name: opencase - parent: opencase.opencase_admin_menu + parent: opencase.opencase_admin_menu url: internal:/opencase/oc_case_fee_type weight: 3 opencase.manage_case_provision_types: title: 'Manage case provision types' description: 'Configure types of case provisions and their fields' menu_name: opencase - parent: opencase.opencase_admin_menu + parent: opencase.opencase_admin_menu url: internal:/opencase/oc_case_provision_type weight: 3 opencase.manage_event_types: title: 'Manage event types' description: 'Configure types of people and their fields' menu_name: opencase - parent: opencase.opencase_admin_menu + parent: opencase.opencase_admin_menu url: internal:/admin/opencase/oc_event_type weight: 1 opencase.reporting: title: 'Reporting' - menu_name: opencase + menu_name: opencase route_name: opencase.opencase_reporting_menu weight: 0 diff --git a/src/Plugin/Derivative/SeeAllOrganisationsMenuLink.php b/src/Plugin/Derivative/SeeAllOrganisationsMenuLink.php new file mode 100644 index 0000000..c563a80 --- /dev/null +++ b/src/Plugin/Derivative/SeeAllOrganisationsMenuLink.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 = []; + $organisationTypes = $this->entityTypeManager->getStorage('oc_organisation_type')->loadMultiple(); + foreach ($organisationTypes as $id => $organisationType) { + $links[$id] = [ + 'title' => $organisationType->label(), + 'route_name' => "view.organisations.page_1", + 'route_parameters' => ['type' => $organisationType->id()] + ] + $base_plugin_definition; + } + return $links; + } +} diff --git a/src/Plugin/Menu/SeeAllOrganisationsMenuLink.php b/src/Plugin/Menu/SeeAllOrganisationsMenuLink.php new file mode 100644 index 0000000..c7e6aa0 --- /dev/null +++ b/src/Plugin/Menu/SeeAllOrganisationsMenuLink.php @@ -0,0 +1,9 @@ +