From eeadf9a0b69604474f84d45d2ce1186220d69cb9 Mon Sep 17 00:00:00 2001 From: Keegan Rankin Date: Thu, 13 Jul 2023 16:34:54 -0700 Subject: [PATCH] Add authors and date to paragraph title template rather than field template Ref #239 --- web/themes/custom/agarica/agarica.theme | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/web/themes/custom/agarica/agarica.theme b/web/themes/custom/agarica/agarica.theme index d3b1480..fb83964 100644 --- a/web/themes/custom/agarica/agarica.theme +++ b/web/themes/custom/agarica/agarica.theme @@ -142,13 +142,8 @@ function agarica_languague_switch_link() { /** * Implements hook_preprocess_HOOK() for field__field_title template. */ -function agarica_preprocess_field__field_title(&$variables) { - $parentEntity = $variables['element']['#object']->getParentEntity(); - if ($parentEntity instanceof EntityInterface && $parentEntity->getEntityTypeId() === 'node') { - if (isset($parentEntity->getFields()['field_authors'])) { - - $variables['authors'] = $variables['element']['#object']->authors_html; - $variables['date'] = $variables['element']['#object']->date_html; - } - } +function agarica_preprocess_paragraph__title(&$variables) { + $field_title = $variables['content']['field_title']['#object']; + $variables['authors'] = $field_title->authors_html; + $variables['date'] = $field_title->date_html; }