Added actor-case relation

This commit is contained in:
2021-08-26 17:55:07 +01:00
parent 8cb50d271b
commit c7d36df842
33 changed files with 2106 additions and 1 deletions

View File

@ -137,3 +137,37 @@ function opencase_query_oc_activity_access_alter($query) {
$query->addJoin('INNER', 'oc_case__actors_involved', 'access_filter', 'access_filter.entity_id = oc_activity_field_data.oc_case');
$query->condition('access_filter.actors_involved_target_id', $linked_actor_id);
}
/**
* Implements hook_theme().
*/
function opencase_cases_theme() {
$theme = [];
$theme['oc_actor_case_relation'] = [
'render element' => 'elements',
'file' => 'oc_actor_case_relation.page.inc',
'template' => 'oc_actor_case_relation',
];
$theme['oc_actor_case_relation_content_add_list'] = [
'render element' => 'content',
'variables' => ['content' => NULL],
'file' => 'oc_actor_case_relation.page.inc',
];
return $theme;
}
/**
* Implements hook_theme_suggestions_HOOK().
*/
function opencase_cases_theme_suggestions_oc_actor_case_relation(array $variables) {
$suggestions = [];
$entity = $variables['elements']['#oc_actor_case_relation'];
$sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
$suggestions[] = 'oc_actor_case_relation__' . $sanitized_view_mode;
$suggestions[] = 'oc_actor_case_relation__' . $entity->bundle();
$suggestions[] = 'oc_actor_case_relation__' . $entity->bundle() . '__' . $sanitized_view_mode;
$suggestions[] = 'oc_actor_case_relation__' . $entity->id();
$suggestions[] = 'oc_actor_case_relation__' . $entity->id() . '__' . $sanitized_view_mode;
return $suggestions;
}