fixed bug where case list link not generated
This commit is contained in:
parent
e588a70a1b
commit
ddab3e450a
@ -94,14 +94,20 @@ class ContextualMenu extends BlockBase {
|
||||
|
||||
/**
|
||||
* Contextual menu for Case page
|
||||
* - Link to case list for the actor that is stored in the session
|
||||
* - Link either the case list for the actor stored in the session (because their case list page was previously loaded)
|
||||
* or the home page
|
||||
* - Link to Activity list for that case
|
||||
*/
|
||||
private function casePage() {
|
||||
$case = \Drupal::routeMatch()->getParameter('oc_case');
|
||||
$actor_id = \Drupal::service('user.private_tempstore')->get('opencase')->get('actor_id');
|
||||
$actor = \Drupal::entityTypeManager()->getStorage('oc_actor')->load($actor_id);
|
||||
$links = [$this->getCaseListLink($actor), $this->getActivityListLink($case)];
|
||||
if ($actor_id) {
|
||||
$actor = \Drupal::entityTypeManager()->getStorage('oc_actor')->load($actor_id);
|
||||
$caseListLink = $this->getCaseListLink($actor);
|
||||
} else {
|
||||
$caseListLink = $this->getCaseListLinkAll();
|
||||
}
|
||||
$links = [$caseListLink, $this->getActivityListLink($case)];
|
||||
return $this->asNavLinks($links);
|
||||
}
|
||||
|
||||
@ -171,6 +177,14 @@ class ContextualMenu extends BlockBase {
|
||||
return Link::fromTextAndUrl(t($actor->getName(). ": Cases"), $url)->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a link to the list of all cases
|
||||
*/
|
||||
private function getCaseListLinkAll() {
|
||||
$url = Url::fromRoute('view.cases.page_2');
|
||||
return Link::fromTextAndUrl(t("All cases"), $url)->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Render given links as nav links div with heading
|
||||
*/
|
||||
|
Reference in New Issue
Block a user