diff --git a/gent_base.theme b/gent_base.theme index bffb10ede..837c2e4b9 100644 --- a/gent_base.theme +++ b/gent_base.theme @@ -435,9 +435,9 @@ function gent_base_preprocess_menu_local_task(&$variables) { * Implements hook_preprocess_field(). */ function gent_base_preprocess_field(&$variables) { - if ($variables["element"]["#field_name"] == 'field_event_subscription_link') { - $variables['items'][0]['content']['#options']['attributes']['class'] = 'button button-secondary'; - } + if ($variables["element"]["#field_name"] == 'field_event_subscription_link') { + $variables['items'][0]['content']['#options']['attributes']['class'] = 'button button-secondary'; + } if ($variables["element"]["#field_name"] == 'field_tags' && count($variables["items"]) > 0) { @@ -467,10 +467,10 @@ function gent_base_preprocess_field(&$variables) { $type = $entity->get('type')->getString(); if ($type === 'timeline_frame') { - $display = _gent_base_get_timeline_display($entity); - $timelineItems = count($entity->get('timeline_items')->referencedEntities()); $variables['items'][$key]['content']['counter'][0] = $timelineItemTotal; + $variables['items'][$key]['content']['first_timeframe'][0] = FALSE; + $variables['items'][$key]['content']['last_timeframe'][0] = FALSE; $timelineItemTotal += $timelineItems; if ($timelineOdd) { @@ -483,36 +483,15 @@ function gent_base_preprocess_field(&$variables) { // It's the first timeline frame. if ($firstTimeline === FALSE) { $firstTimeline = TRUE; - - switch ($display) { - case 'timeline': - $variables['items'][$key]['content']['#prefix'] = - '

' . t('timeline') . '

' . - '
'; - break; - case 'program': - $isProgram = TRUE; - $variables['items'][$key]['content']['#prefix'] = - '

' . t('programme') . '

' . - '
'; - break; - case 'roadmap': - $variables['items'][$key]['content']['#prefix'] = - '
' . - '
'; - break; - } + $variables['items'][$key]['content']['first_timeframe'][0] = TRUE; + } + if (count($paragraphs) === $key+1) { + $variables['items'][$key]['content']['last_timeframe'][0] = TRUE; } } elseif ($firstTimeline === TRUE) { $firstTimeline = FALSE; - - if ($isProgram) { - $variables['items'][$key - 1]['content']['#suffix'] = '
'; - } - else { - $variables['items'][$key - 1]['content']['#suffix'] = '
'; - } + $variables['items'][$key-1]['content']['last_timeframe'][0] = TRUE; } } } diff --git a/templates/contrib/paragraphs/timeline/paragraph--timeline-frame--program.html.twig b/templates/contrib/paragraphs/timeline/paragraph--timeline-frame--program.html.twig index d991a76e9..5b5417d3f 100644 --- a/templates/contrib/paragraphs/timeline/paragraph--timeline-frame--program.html.twig +++ b/templates/contrib/paragraphs/timeline/paragraph--timeline-frame--program.html.twig @@ -39,19 +39,20 @@ */ #} -{% set items_total = content.counter.0 %} -{% set reversed = content.reversed.0 %} - -{% set classes = [ - 'programme-slot', - items_total is odd ? 'timeline-slot-odd' : 'timeline-slot-even', - reversed ? 'timeline-slot-reverse' : '' -] %} {{ attach_library('gent_base/modal') }} +{% set first_timeframe = content.first_timeframe.0 %} +{% set last_timeframe = content.last_timeframe.0 %} + {% block paragraph %} {% block content %} - + {% if first_timeframe == TRUE %} + +

programme

+
+
+ {% endif %} +

{{ content.title }}

@@ -63,5 +64,10 @@
+ {% if last_timeframe == TRUE %} + +
+ + {% endif %} {% endblock %} {% endblock paragraph %} diff --git a/templates/contrib/paragraphs/timeline/paragraph--timeline-frame--roadmap.html.twig b/templates/contrib/paragraphs/timeline/paragraph--timeline-frame--roadmap.html.twig index 6a1888407..6e8793f61 100644 --- a/templates/contrib/paragraphs/timeline/paragraph--timeline-frame--roadmap.html.twig +++ b/templates/contrib/paragraphs/timeline/paragraph--timeline-frame--roadmap.html.twig @@ -39,9 +39,23 @@ */ #} +{% set first_timeframe = content.first_timeframe.0 %} +{% set last_timeframe = content.last_timeframe.0 %} + {% block paragraph %} {% block content %} + {% if first_timeframe == TRUE %} +
+
+ {% endif %} +

{{ content.title }}

+ {{ content.timeline_items }} + + {% if last_timeframe == TRUE %} +
+
+ {% endif %} {% endblock %} {% endblock paragraph %} diff --git a/templates/contrib/paragraphs/timeline/paragraph--timeline-frame--timeline.html.twig b/templates/contrib/paragraphs/timeline/paragraph--timeline-frame--timeline.html.twig index c088186cc..f23ea168d 100644 --- a/templates/contrib/paragraphs/timeline/paragraph--timeline-frame--timeline.html.twig +++ b/templates/contrib/paragraphs/timeline/paragraph--timeline-frame--timeline.html.twig @@ -41,16 +41,17 @@ {% set items_total = content.counter.0 %} {% set reversed = content.reversed.0 %} - -{% set classes = [ - 'timeline-slot', - items_total is odd ? 'timeline-slot-odd' : 'timeline-slot-even', - reversed ? 'timeline-slot-reverse' : '' -] %} +{% set first_timeframe = content.first_timeframe.0 %} +{% set last_timeframe = content.last_timeframe.0 %} {% block paragraph %} {% block content %} - + {% if first_timeframe == TRUE %} + +

timeline

+
+ {% endif %} +
{% if content.title %}

{{ content.title }}

@@ -59,5 +60,9 @@ {{ content.timeline_items }}
+ {% if last_timeframe == TRUE %} +
+ + {% endif %} {% endblock %} {% endblock paragraph %} diff --git a/templates/contrib/paragraphs/timeline/paragraph--timeline-item--program.html.twig b/templates/contrib/paragraphs/timeline/paragraph--timeline-item--program.html.twig index c0c9e9f75..ab480b163 100644 --- a/templates/contrib/paragraphs/timeline/paragraph--timeline-item--program.html.twig +++ b/templates/contrib/paragraphs/timeline/paragraph--timeline-item--program.html.twig @@ -52,7 +52,7 @@