From 2e071af1b766c14c7ad5f4b1e535421822e561db Mon Sep 17 00:00:00 2001 From: naomi Date: Thu, 19 May 2022 10:46:22 +0100 Subject: [PATCH] added static/dynamic divs to actor --- modules/opencase_entities/oc_actor.page.inc | 14 +------------- .../opencase_entities/templates/oc_actor.html.twig | 7 +++++-- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/modules/opencase_entities/oc_actor.page.inc b/modules/opencase_entities/oc_actor.page.inc index 88f346e..f2f1a05 100644 --- a/modules/opencase_entities/oc_actor.page.inc +++ b/modules/opencase_entities/oc_actor.page.inc @@ -20,17 +20,5 @@ use Drupal\Core\Render\Element; * - attributes: HTML attributes for the containing element. */ function template_preprocess_oc_actor(array &$variables) { - // Make the id available to the template and also separate the fields - // into two sections to be displayed in two columns. - $variables['id'] = $variables['elements']['#oc_actor']->get('id')[0]->get('value')->getValue(); - $variables['contact_details'] = array(); - $variables['fields_other_than_contact_details'] = array(); - foreach (Element::children($variables['elements']) as $key) { - $variables['content'][$key] = $variables['elements'][$key]; - if (in_array($key, ['email', 'phone', 'phone2', 'postal_address', 'post_code'])) { - $variables['contact_details'][$key] = $variables['elements'][$key]; - } else { - $variables['fields_other_than_contact_details'][$key] = $variables['elements'][$key]; - } - } +_template_preprocess_entity($variables); } diff --git a/modules/opencase_entities/templates/oc_actor.html.twig b/modules/opencase_entities/templates/oc_actor.html.twig index e92f6da..9d619ba 100644 --- a/modules/opencase_entities/templates/oc_actor.html.twig +++ b/modules/opencase_entities/templates/oc_actor.html.twig @@ -16,7 +16,10 @@ */ #} - {% if content %} - {{- content -}} + {% if normal_fields %} +
{{- normal_fields -}}
+ {% endif %} + {% if extra_fields %} +
{{- extra_fields -}}
{% endif %}