drowl_paragraphs_bs-1.x-dev/modules/drowl_paragraphs_bs_type_countdown/templates/paragraph--drowl-paragraphs-bs--countdown.html.twig
modules/drowl_paragraphs_bs_type_countdown/templates/paragraph--drowl-paragraphs-bs--countdown.html.twig
{% extends "@drowl_paragraphs_bs/paragraph--drowl-paragraphs-bs.html.twig" %}
{#
/**
* @file
* Default theme implementation to display a paragraph.
*
* Available variables:
* - paragraph: Full paragraph entity.
* Only method names starting with "get", "has", or "is" and a few common
* methods such as "id", "label", and "bundle" are available. For example:
* - paragraph.getCreatedTime() will return the paragraph creation timestamp.
* - paragraph.id(): The paragraph ID.
* - paragraph.bundle(): The type of the paragraph, for example, "image" or "text".
* - paragraph.getOwnerId(): The user ID of the paragraph author.
* See Drupal\paragraphs\Entity\Paragraph for a full list of public properties
* and methods for the paragraph object.
* - content: All paragraph items. Use {{ content }} to print them all,
* or print a subset such as {{ content.field_example }}. Use
* {{ content|without('field_example') }} to temporarily suppress the printing
* of a given child element.
* - attributes: HTML attributes for the containing element.
* The attributes.class element may contain one or more of the following
* classes:
* - paragraphs: The current template type (also known as a "theming hook").
* - paragraphs--type-[type]: The current paragraphs type. For example, if the paragraph is an
* "Image" it would result in "paragraphs--type--image". Note that the machine
* name will often be in a short form of the human readable label.
* - paragraphs--view-mode--[view_mode]: The View Mode of the paragraph; for example, a
* preview would result in: "paragraphs--view-mode--preview", and
* default: "paragraphs--view-mode--default".
* - view_mode: View mode; for example, "preview" or "full".
* - logged_in: Flag for authenticated user status. Will be true when the
* current user is a logged-in member.
* - is_admin: Flag for admin user status. Will be true when the current user
* is an administrator.
*
* % extends "paragraph.html.twig" %
* @see template_preprocess_paragraph()
*
* @ingroup themeable
*/
#}
{% set target_date_timestamp_localized = paragraph.field_date.0.date|date('U') %}
{% set countdown_theme = paragraph.field_color_scheme.0.value|default('dark')|e('html_attr') %}
{% block paragraph %}
{{ attach_library('drowl_paragraphs_bs_type_countdown/global') }}
{{ parent() }}
{% endblock %}
{% block content %}
{% if paragraph.field_date.0 and target_date_timestamp_localized %}
{#
@todo Replace old "flipdown.js" library, see
https://www.drupal.org/project/drowl_paragraphs_bs/issues/3389170
#}
<div id="countdown-{{ paragraph.id() }}" class="countdown" data-target-date="{{ target_date_timestamp_localized }}" data-countdown-theme="{{ countdown_theme }}"></div>
<div class="countdown-no-js-fallback">
{# Fallback - hidden by JS if countdown script initialized #}
<div class="h3">{{ 'Target Time:'|t }}</div>
<div class="countdown__no-js-fallback-time">
{{ target_date_timestamp_localized|format_date('short') }}
</div>
</div>
{% endif %}
{% endblock %}
