diff --git a/hdbt.theme b/hdbt.theme index 37214518f..81bcf0c32 100644 --- a/hdbt.theme +++ b/hdbt.theme @@ -1547,3 +1547,21 @@ function hdbt_preprocess_paragraph__school_search(array &$variables): void { $variables['#attached']['drupalSettings']['helfi_school_search']['cookie_privacy_url'] = $privacyUrl->toString(); } } + +/** + * Implements hook_preprocess_HOOK(). + */ +function hdbt_preprocess_node__announcement(array &$variables) { + $type = $variables['node']->get('field_announcement_type')->value; + + $type_label = match($type) { + 'alert' => t('Alert'), + 'attention' => t('Attention'), + default => t('Notification') + }; + + $close_label = t('Close'); + + $variables['type_label'] = $type_label; + $variables['close_label'] = $close_label; +} diff --git a/templates/content/node--announcement--default.html.twig b/templates/content/node--announcement--default.html.twig index 926aae536..66d3e9ee8 100644 --- a/templates/content/node--announcement--default.html.twig +++ b/templates/content/node--announcement--default.html.twig @@ -8,7 +8,7 @@ {% set link = content.field_announcement_link[0] %} -
+
{% if content.body|render != null %} @@ -23,7 +23,7 @@ {% endif %}
-
+ \ No newline at end of file diff --git a/templates/misc/status-messages.html.twig b/templates/misc/status-messages.html.twig index 57906b8d8..7e32e5fb9 100644 --- a/templates/misc/status-messages.html.twig +++ b/templates/misc/status-messages.html.twig @@ -50,7 +50,7 @@
{% set is_message_with_title = status_headings[type] %} {% set is_message_with_icon = type in ['error', 'default', 'warning', 'success'] %} -