getParameter('oc_actor');
$target_id = $actor->id();
$actorType = $actor->bundle();
$markup = "
";
$case_types = $this->getCaseTypesToDisplay($actorType);
foreach($case_types as $id => $info) {
$label = $info['label'];
$markup .= "foo";
#$markup .= "- $label
";
}
$markup .= "
";
return array('#markup' => $markup);
}
public function getCacheMaxAge():int {
return 0;
}
private function getCaseTypesToDisplay(string $actorType): array {
// Client modules will provide a list of what case types (bundles) are relevant for each actor type.
// Check if they are implemented, and if so display them.
$implemented_case_types = \Drupal::service('entity_type.bundle.info')->getBundleInfo('oc_case');
$relevant_case_type_ids = \Drupal::moduleHandler()->invokeAll('relevant_case_type_ids', [$actorType]);
$case_types_to_display = [];
foreach ($relevant_case_type_ids as $type_id) {
if (array_key_exists($type_id, $implemented_case_types)) {
$case_types_to_display[$type_id] = $implemented_case_types[$type_id];
}
}
return $case_types_to_display;
}
}