Edited template to place "EVA" fields (embedded views) at the top of case page.

This commit is contained in:
naomi 2021-01-23 18:12:35 +00:00
parent 146eb2b8ba
commit e49ad3fc9c
2 changed files with 8 additions and 0 deletions

View File

@ -23,12 +23,15 @@ function template_preprocess_oc_case(array &$variables) {
// Separate the fields into two sections to be displayed in two columns.
// Remove the name (title) field as this is displayed anyway.
$variables['id'] = $variables['elements']['#oc_case']->get('id')[0]->get('value')->getValue();
$variables['eva_fields'] = array(); // if the installation has any "EVA" (embedded view) fields this should catch them.
$variables['base_fields'] = array();
$variables['other_fields'] = array();
foreach (Element::children($variables['elements']) as $key) {
$variables['content'][$key] = $variables['elements'][$key];
if (in_array($key, ['created', 'changed', 'files', 'actors_involved', 'status', 'user_id'])) {
$variables['base_fields'][$key] = $variables['elements'][$key];
} else if (strpos($key, "entity_view") !== false) {
$variables['eva_fields'][$key] = $variables['elements'][$key];
} else {
$variables['other_fields'][$key] = $variables['elements'][$key];
unset($variables['other_fields']['name']);

View File

@ -18,6 +18,11 @@
<div{{ attributes.addClass('oc_case') }}>
<h2>{{ title }}</h2>
<div class="oc_entity">
<div class="eva_fields">
{% for field in eva_fields %}
{{ field }}
{% endfor %}
</div>
<div class="left">
{{ base_fields.actors_involved }}
{{ base_fields.changed }}