From ee98ed2498185edc146e696249250e018fbb422b Mon Sep 17 00:00:00 2001 From: Andy Broomfield Date: Mon, 9 Sep 2024 18:48:56 +0100 Subject: [PATCH 1/2] Support showing type of alert in the banner template Alter template to show the type of alert if present on manage display --- templates/localgov-alert-banner.html.twig | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/templates/localgov-alert-banner.html.twig b/templates/localgov-alert-banner.html.twig index 4d7d38d5..e7cbf39e 100644 --- a/templates/localgov-alert-banner.html.twig +++ b/templates/localgov-alert-banner.html.twig @@ -39,14 +39,23 @@
{# Begin Content #}
- {% if display_title %} -

- {{ content.title }} -

+ {% if display_title or content.type_of_alert %} +
+ {% if display_title %} +

+ {{ content.title }} +

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

+ {{ content.type_of_alert }} +

+ {% endif %} +
{% endif %}
- {{ content|without('title', 'link') }} + {{ content|without('title', 'link', 'type_of_alert') }}
{% if has_link %} From d9fe1ee8720798e53c4bf14ba5cdc9943885246e Mon Sep 17 00:00:00 2001 From: Andy Broomfield Date: Mon, 9 Sep 2024 19:07:16 +0100 Subject: [PATCH 2/2] Show the type of alert in the banner by default --- ...lgov_alert_banner.localgov_alert_banner.default.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/config/install/core.entity_view_display.localgov_alert_banner.localgov_alert_banner.default.yml b/config/install/core.entity_view_display.localgov_alert_banner.localgov_alert_banner.default.yml index 46f867a3..4350cf93 100644 --- a/config/install/core.entity_view_display.localgov_alert_banner.localgov_alert_banner.default.yml +++ b/config/install/core.entity_view_display.localgov_alert_banner.localgov_alert_banner.default.yml @@ -33,7 +33,7 @@ content: type: link region: content short_description: - weight: 1 + weight: 2 label: hidden settings: { } third_party_settings: { } @@ -47,8 +47,14 @@ content: settings: link_to_entity: false third_party_settings: { } + type_of_alert: + type: list_default + label: hidden + settings: { } + third_party_settings: { } + weight: 1 + region: content hidden: content_moderation_control: true - type_of_alert: true uid: true visibility: true