diff --git a/modules/opencase_defaults/opencase_defaults.links.menu.yml b/modules/opencase_defaults/opencase_defaults.links.menu.yml index 676786c..3eee8e2 100644 --- a/modules/opencase_defaults/opencase_defaults.links.menu.yml +++ b/modules/opencase_defaults/opencase_defaults.links.menu.yml @@ -10,3 +10,9 @@ opencase_defaults.report_on_volunteers: parent: opencase_reporting.reporting_menu url: internal:/opencase/reporting/volunteers weight: 1 +opencase_defaults.opencase_all_cases: + title: 'Cases' + menu_name: opencase + parent: opencase.see_all + url: internal:/opencase/all-cases + weight: -1 diff --git a/modules/opencase_defaults/opencase_defaults.module b/modules/opencase_defaults/opencase_defaults.module index 4364b36..6238add 100644 --- a/modules/opencase_defaults/opencase_defaults.module +++ b/modules/opencase_defaults/opencase_defaults.module @@ -25,6 +25,31 @@ function opencase_defaults_help($route_name, RouteMatchInterface $route_match) { } } +/** + * Implements hook_preprocess_page_title + * + * Modify the page title to include more information + */ +function opencase_defaults_preprocess_page_title(&$variables) { + + $route_name = \Drupal::routeMatch()->getRouteName(); + switch ($route_name) { + case 'entity.oc_case.canonical': + $case = \Drupal::routeMatch()->getParameter('oc_case'); + $variables['title'] = $case->getName() . ": Case Details and Files"; + break; + case 'view.cases.page_1': + $actor_id = \Drupal::routeMatch()->getParameter('actor_id'); + $actor = \Drupal::entityTypeManager()->getStorage('oc_actor')->load($actor_id); + $variables['title'] = $actor->getName() . ": Cases"; + break; + case 'view.activities.page_1': + $case_id = \Drupal::routeMatch()->getParameter('case_id'); + $case = \Drupal::entityTypeManager()->getStorage('oc_case')->load($case_id); + $variables['title'] = $case->getName() . ": Activities"; + break; + } +} /** * Implements hook_theme(). */