From 27cb58512e3e575e9246f5dc3471b21fdd9e3201 Mon Sep 17 00:00:00 2001 From: Naomi Date: Mon, 9 Nov 2020 17:50:09 +0000 Subject: [PATCH] Added menu links for seeing lists of things, also updated install.txt --- docs/install.txt | 8 +++ .../opencase_defaults.links.menu.yml | 3 +- opencase.links.menu.yml | 5 ++ .../Derivative/SeeAllActorsMenuLink.php | 55 +++++++++++++++++++ src/Plugin/Menu/SeeAllActorsMenuLink.php | 9 +++ 5 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 src/Plugin/Derivative/SeeAllActorsMenuLink.php create mode 100644 src/Plugin/Menu/SeeAllActorsMenuLink.php diff --git a/docs/install.txt b/docs/install.txt index 9b4bb31..ae130c8 100644 --- a/docs/install.txt +++ b/docs/install.txt @@ -3,15 +3,23 @@ SYSTEM apt install php-gd php-mbstring php-xml php-curl composer a2enmod rewrite + + SITE ==== #TODO make the vhost #TODO in apache2.conf set Override All on the directory + DRUPAL ====== + composer create-project drupal/recommended-project drupal +#TODO place composer.json in the drupal directory that should have appeared + +composer install + mysql -uroot -p drop database ...; create database ...; diff --git a/modules/opencase_defaults/opencase_defaults.links.menu.yml b/modules/opencase_defaults/opencase_defaults.links.menu.yml index 6976b9d..7b8f542 100644 --- a/modules/opencase_defaults/opencase_defaults.links.menu.yml +++ b/modules/opencase_defaults/opencase_defaults.links.menu.yml @@ -16,5 +16,4 @@ opencase.opencase_all_cases: menu_name: opencase parent: opencase.see_all url: internal:/opencase/all-cases - weight: 1 - + weight: -1 diff --git a/opencase.links.menu.yml b/opencase.links.menu.yml index 533716f..fc464d5 100644 --- a/opencase.links.menu.yml +++ b/opencase.links.menu.yml @@ -3,6 +3,11 @@ opencase.see_all: menu_name: opencase route_name: opencase.opencase_cases_menu weight: 0 +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..3aada7f --- /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().'s', + 'route_name' => "view.all_actors_of_a_type.page_1", + 'route_parameters' => ['actor_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..b54ba55 --- /dev/null +++ b/src/Plugin/Menu/SeeAllActorsMenuLink.php @@ -0,0 +1,9 @@ +