diff --git a/src/Controller/ReferralController.php b/src/Controller/ReferralController.php index d5962da..ccba588 100644 --- a/src/Controller/ReferralController.php +++ b/src/Controller/ReferralController.php @@ -34,11 +34,15 @@ class ReferralController extends AbstractController private array $navLinks = [] ) { $this->navLinks = NavList::LIST; - $this->navLinks['case_list'] = NavList::PRESENT_LINK; + if (strpos($_SERVER['HTTP_REFERER'], 'my-cases') !== false) { + $this->navLinks['my_cases'] = NavList::PRESENT_LINK; + } else { + $this->navLinks['case_list'] = NavList::PRESENT_LINK; + } } #[Route('/list-referrals/{id}', name: 'app_list_referrals')] - public function listReferrals(#[CurrentUser()] User $user, string $id): Response + public function listReferrals(#[CurrentUser()] User $user, string $id, Request $request): Response { $this->msgs = $this->entityManager->getRepository(Messages::class)->getUnreadMessages($user); $this->notificationCount = $this->entityManager->getRepository(Messages::class)->getUnreadMessageCount($user); @@ -53,7 +57,11 @@ class ReferralController extends AbstractController $this->navLinks, [ 'breadcrumbs' => [ - new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases'), + ( + strpos($request->server->get('HTTP_REFERER'), 'my-cases') !== false + ? new Breadcrumb($this->generateUrl('app_my_cases'), 'My Cases') + : new Breadcrumb($this->generateUrl('app_list_cases'), 'List Cases') + ), new Breadcrumb($this->generateUrl('app_list_referrals', ['id' => $case->getId()]), 'Referrals'), ], 'notifications' => $this->msgs,