Added case list link to add-new-case page
This commit is contained in:
@ -28,20 +28,29 @@ class ContextualMenu extends BlockBase {
|
||||
$route_name = \Drupal::routeMatch()->getRouteName();
|
||||
switch ($route_name) {
|
||||
case 'entity.oc_actor.canonical':
|
||||
case 'entity.oc_actor.edit_form':
|
||||
$markup = $this->actorPage();
|
||||
break;
|
||||
case 'view.cases.page_1':
|
||||
$markup = $this->caseListPage();
|
||||
break;
|
||||
case 'entity.oc_case.canonical':
|
||||
case 'entity.oc_case.edit_form':
|
||||
$markup = $this->casePage();
|
||||
break;
|
||||
case 'entity.oc_case.add_form':
|
||||
$markup = $this->caseAddPage();
|
||||
break;
|
||||
case 'view.activities.page_1':
|
||||
$markup = $this->activityListPage();
|
||||
break;
|
||||
case 'entity.oc_activity.canonical':
|
||||
case 'entity.oc_activity.edit_form':
|
||||
$markup = $this->activityPage();
|
||||
break;
|
||||
case 'entity.oc_activity.add_form':
|
||||
$markup = $this->activityAddPage();
|
||||
break;
|
||||
}
|
||||
|
||||
$build = [];
|
||||
@ -87,6 +96,17 @@ class ContextualMenu extends BlockBase {
|
||||
return $this->asNavLinks([$link]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Contextual menu for Add-New-Case page
|
||||
* - Link to Case list for the actor
|
||||
*/
|
||||
private function caseAddPage() {
|
||||
$actor_id = \Drupal::request()->query->get('actor_id');
|
||||
$actor = \Drupal::entityTypeManager()->getStorage('oc_actor')->load($actor_id);
|
||||
$link = $this->getCaseListLink($actor);
|
||||
return $this->asNavLinks([$link]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Contextual menu for Activity list page
|
||||
* - Link to the case that the activity list is for
|
||||
@ -113,6 +133,18 @@ class ContextualMenu extends BlockBase {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Contextual menu for Add-New-Activity page
|
||||
* - Links to the activity list for the case
|
||||
*/
|
||||
private function activityAddPage() {
|
||||
$case_id = \Drupal::request()->query->get('case_id');
|
||||
$case = \Drupal::entityTypeManager()->getStorage('oc_case')->load($case_id);
|
||||
$link = $this->getActivityListLink($case);
|
||||
return $this->asNavLinks([$link]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Given an case entity, returns a link to the activity list
|
||||
*/
|
||||
|
Reference in New Issue
Block a user