-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create content-item-entity--alert-banner.html.twig
Showing
1 changed file
with
107 additions
and
0 deletions.
There are no files selected for viewing
107 changes: 107 additions & 0 deletions
107
templates/content/content-item-entity--alert-banner.html.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
{# | ||
/** | ||
* @file content_item_entity.html.twig | ||
* Default theme implementation to present Content Item data. | ||
* | ||
* This template is used when viewing Content Item pages. | ||
* | ||
* | ||
* Available variables: | ||
* - content: A list of content items. Use 'content' to print all content, or | ||
* - attributes: HTML attributes for the container element. | ||
* | ||
* @see template_preprocess_content_item_entity() | ||
* | ||
* @ingroup themeable | ||
*/ | ||
#} | ||
{% set wrapper_attributes = create_attribute() %} | ||
{% set button_attributes = create_attribute() %} | ||
{% set icon_attributes = create_attribute() %} | ||
{% set title_attributes = create_attribute() %} | ||
{% set content_attributes = create_attribute() %} | ||
{% set alertStyle = content.field_alert_type['#items'].getString() %} | ||
{% | ||
set classes = [ | ||
'content_item_entity', | ||
'content-item--type-alert-banner', | ||
'text-formatted', | ||
'message', | ||
'message--' ~ alertStyle|clean_class, | ||
'shadow-lg', | ||
'my-0', | ||
'p-0', | ||
'js-dismiss', | ||
] | ||
%} | ||
{% | ||
set wrapperClasses = [ | ||
'container', | ||
'relative', | ||
'flex', | ||
'items-center', | ||
'px-4', | ||
'mx-auto', | ||
'sm--px-0', | ||
] | ||
%} | ||
{% | ||
set buttonClasses = [ | ||
'absolute', | ||
'top-0', | ||
'right-0', | ||
'px-4', | ||
'py-3', | ||
'leading-none', | ||
'text-black', | ||
'close', | ||
'hover--bg-white-transparent', | ||
'hover--no-underline', | ||
'hover--text-black', | ||
'message__close', | ||
'js-dismiss__trigger', | ||
] | ||
%} | ||
{% | ||
set iconClasses = [ | ||
'flex-none', | ||
'inline-block', | ||
'w-12', | ||
'h-12', | ||
'mr-4', | ||
'xl--w-20', | ||
'xl--h-20', | ||
'text-ubc-blue', | ||
'xl--mr-8', | ||
] | ||
%} | ||
{% | ||
set titleClasses = [ | ||
'mt-0', | ||
'message__title', | ||
'h4', | ||
] | ||
%} | ||
{% | ||
set contentClasses = [ | ||
'message__content', | ||
'first-child--mt-0', | ||
] | ||
%} | ||
{% set card_icon = content.field_alert_icon['#items'].entity.field_id.value %} | ||
<div{{ attributes.addClass(classes) }} role="status" aria-live="polite"> | ||
<div{{ wrapper_attributes.addClass(wrapperClasses) }}> | ||
<button{{ button_attributes.addClass(buttonClasses) }} data-dismiss="message">×</button> | ||
{% if not (content_item_entity.field_alert_icon.isEmpty == true) and content.field_alert_icon is defined %} | ||
<svg{{ icon_attributes.addClass(iconClasses) }} role="presentation"> | ||
<use xlink:href="#{{ card_icon }}"></use> | ||
</svg> | ||
{% endif %} | ||
<div class="py-2"> | ||
{% if not (content_item_entity.field_alert_title.isEmpty == true) and content.field_alert_title is defined %} | ||
<h2{{ title_attributes.addClass(titleClasses) }}>{{ content.field_alert_title }}</h2> | ||
{% endif %} | ||
<div{{ content_attributes.addClass(contentClasses) }}>{{ content.field_alert_message.0 }}</div> | ||
</div> | ||
</div> | ||
</div> |