sample files from a smithsonian project

This commit is contained in:
2024-05-22 00:26:01 -04:00
commit 265541edc3
76 changed files with 2140 additions and 0 deletions
@@ -0,0 +1,23 @@
{% set image %}
{% if content.field_header.0['#paragraph'].field_image is not empty %}
{% set url = file_url(content.field_header.0['#paragraph'].field_image.entity.field_media_image.entity.uri.value) %}
{% set alt = content.field_header.0['#paragraph'].field_image.entity.field_media_image.alt %}
<img src="{{ url }}" alt="{{ alt }}"/>
{% else %}
<img src="/themes/custom/cdesai_emulsify/images/default.jpg" alt="sample placeholder image" />
{% endif %}
{% endset %}
{% include '@templates/publication.twig' with {
publication_header: content.field_header|field_value,
publication_media: image,
publication_purchase_url: content.field_url.0['#url'],
publication_author: content.field_authors|field_value,
publication_editor: content.field_editors|field_value,
publication_publisher: content.field_publisher|field_value,
publication_year: content.field_year|field_value,
publication_series: content.field_series|field_value,
publication_type: content.field_publication_type|field_value,
publication_body: content.body,
publication_related_content: false
}%}
@@ -0,0 +1,26 @@
{# Set image from page header if it exists #}
{% if content.field_header.0['#paragraph'].field_image is not empty %}
{% set src = file_url(content.field_header.0['#paragraph'].field_image.entity.field_media_image.entity.uri.value|image_style('medium_4x3')) %}
{% set alt = content.field_header.0['#paragraph'].field_image.entity.field_media_image.alt %}
{% set image %}
<img src="{{ src }}" alt="{{ alt ? alt : '' }}" />
{% endset %}
{% endif %}
{# Trim summary #}
{% if content.field_summary.0['#context'].value|length > 250 %}
{% set summary %}
{{ content.field_summary.0['#context'].value|slice(0, 250) }}...
{% endset %}
{% else %}
{% set summary = content.field_summary|field_value %}
{% endif %}
{% include "@components/search-listing/search-listing.twig" with {
listing_eyebrow: 'Publication'|t,
listing_title: label,
listing_meta: false,
listing_summary: summary,
listing_media: image ? image : false,
listing_url: url,
}%}
@@ -0,0 +1,28 @@
{% set image %}
{% if content.field_header|render|striptags('<img>')|trim %}
{{ content.field_header }}
{% else %}
<img src="/themes/custom/cdesai_emulsify/images/default.jpg" alt="" aria-hidden="true" />
{% endif %}
{% endset %}
{% embed "@components/teaser/teaser--listing/teaser--listing.twig" with {
teaser_media: image,
teaser_url: url,
teaser_link_text: 'View publication details'|t,
teaser_link_title: label,
modifier_classes: attributes.class|join(' ')|trim,
drupal_attributes: attributes|without('class'),
} %}
{% block content %}
{{ title_suffix.contextual_links }}
{{ content.field_year }}
{% include '@components/teaser/_teaser-title.twig' with {
title_tag: 'h4',
teaser_title: label,
modifier_classes: false,
drupal_attributes: false,
} %}
{{ content|without('field_header', 'field_year') }}
{% endblock %}
{% endembed %}
@@ -0,0 +1,21 @@
{% set image %}
{% if content.field_header.0['#paragraph'].field_image is not empty %}
{% set src = file_url(content.field_header.0['#paragraph'].field_image.entity.field_media_image.entity.uri.value|image_style('medium_4x3')) %}
{% set alt = content.field_header.0['#paragraph'].field_image.entity.field_media_image.alt %}
<img src="{{ src }}" alt="{{ alt ? alt : '' }}"/>
{% else %}
<img src="/themes/custom/cdesai_emulsify/images/default.jpg" alt="sample placeholder image" />
{% endif %}
{% endset %}
{% include "@components/teaser/teaser.twig" with {
modifier_classes: attributes.class|join(' ')|trim,
drupal_attributes: attributes|without('class'),
teaser_image: image,
teaser_eyebrow: content.field_year|field_value,
teaser_title: label|field_value,
teaser_body: content.field_summary|field_value,
teaser_link_class: 'arrow-link',
teaser_link_url: url,
teaser_link_text: 'Read More'
}%}
@@ -0,0 +1,7 @@
{% include "@templates/story.twig" with {
story_has_footer: tags is not empty ? true : false,
story_header: content.field_header|field_value,
story_content: content.field_content|field_value,
story_tags: content.field_keywords|field_value,
story_related_stories: drupal_view('story_related_card')
}%}
@@ -0,0 +1,15 @@
{% set image %}
{% if content.field_header|render|striptags('<img>')|trim is not empty %}
{{ content.field_header }}
{% else %}
<img src="/themes/custom/cdesai_emulsify/images/default.jpg" alt="" aria-hidden="true" />
{% endif %}
{% endset %}
{% include "@components/related-content/_related-content-item.twig" with {
title: label,
url: url,
date: content|without('field_header'),
media: image,
header_id: 'related-card-' ~ node.id(),
}%}
@@ -0,0 +1,26 @@
{# Set image from page header if it exists #}
{% if content.field_header.0['#paragraph'].field_image is not empty %}
{% set src = file_url(content.field_header.0['#paragraph'].field_image.entity.field_media_image.entity.uri.value|image_style('medium_4x3')) %}
{% set alt = content.field_header.0['#paragraph'].field_image.entity.field_media_image.alt %}
{% set image %}
<img src="{{ src }}" alt="{{ alt ? alt : '' }}" />
{% endset %}
{% endif %}
{# Trim summary #}
{% if content.field_summary.0['#context'].value|length > 250 %}
{% set summary %}
{{ content.field_summary.0['#context'].value|slice(0, 250) }}...
{% endset %}
{% else %}
{% set summary = content.field_summary|field_value %}
{% endif %}
{% include "@components/search-listing/search-listing.twig" with {
listing_eyebrow: 'Story'|t,
listing_title: label,
listing_meta: false,
listing_summary: summary,
listing_media: image ? image : false,
listing_url: url,
}%}
@@ -0,0 +1,26 @@
{% set image %}
{% if content.field_header|render|striptags('<img>')|trim %}
{{ content.field_header }}
{% else %}
<img src="/themes/custom/cdesai_emulsify/images/default.jpg" alt="" aria-hidden="true" />
{% endif %}
{% endset %}
{% embed "@components/teaser/teaser--listing/teaser--listing.twig" with {
teaser_media: image,
teaser_url: url,
teaser_link_text: 'Read story'|t,
teaser_link_title: label,
modifier_classes: attributes.class|join(' ')|trim,
drupal_attributes: attributes|without('class'),
} %}
{% block content %}
{{ title_suffix.contextual_links }}
{{ content.field_series }}
{% include '@components/teaser/_teaser-title.twig' with {
title_tag: 'h4',
teaser_title: label,
} %}
{{ content|without('field_header', 'field_series') }}
{% endblock %}
{% endembed %}
@@ -0,0 +1,19 @@
{% set image %}
{% if content.field_header.0['#paragraph'].field_image is not empty %}
{% set src = file_url(content.field_header.0['#paragraph'].field_image.entity.field_media_image.entity.uri.value|image_style('medium_4x3')) %}
{% set alt = content.field_header.0['#paragraph'].field_image.entity.field_media_image.alt %}
<img src="{{ src }}" alt="{{ alt ? alt : '' }}"/>
{% else %}
<img src="/themes/custom/cdesai_emulsify/images/default.jpg" alt="sample placeholder image" />
{% endif %}
{% endset %}
{% include "@components/teaser/teaser.twig" with {
teaser_image: image,
teaser_eyebrow: content.field_series|field_value,
teaser_title: label|field_value,
teaser_body: content.field_summary|field_value,
teaser_link_class: 'arrow-link',
teaser_link_url: url,
teaser_link_text: 'Read More'
}%}
+95
View File
@@ -0,0 +1,95 @@
{#
/**
* @file
* Theme override to display a node.
*
* Available variables:
* - node: The node entity with limited access to object properties and methods.
* Only method names starting with "get", "has", or "is" and a few common
* methods such as "id", "label", and "bundle" are available. For example:
* - node.getCreatedTime() will return the node creation timestamp.
* - node.hasField('field_example') returns TRUE if the node bundle includes
* field_example. (This does not indicate the presence of a value in this
* field.)
* - node.isPublished() will return whether the node is published or not.
* Calling other methods, such as node.delete(), will result in an exception.
* See \Drupal\node\Entity\Node for a full list of public properties and
* methods for the node object.
* - label: The title of the node.
* - content: All node 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.
* - author_picture: The node author user entity, rendered using the "compact"
* view mode.
* - metadata: Metadata for this node.
* - date: Themed creation date field.
* - author_name: Themed author name field.
* - url: Direct URL of the current node.
* - display_submitted: Whether submission information should be displayed.
* - attributes: HTML attributes for the containing element.
* The attributes.class element may contain one or more of the following
* classes:
* - node: The current template type (also known as a "theming hook").
* - node--type-[type]: The current node type. For example, if the node is an
* "Article" it would result in "node--type-article". Note that the machine
* name will often be in a short form of the human readable label.
* - node--view-mode-[view_mode]: The View Mode of the node; for example, a
* teaser would result in: "node--view-mode-teaser", and
* full: "node--view-mode-full".
* The following are controlled through the node publishing options.
* - node--promoted: Appears on nodes promoted to the front page.
* - node--sticky: Appears on nodes ordered above other non-sticky nodes in
* teaser listings.
* - node--unpublished: Appears on unpublished nodes visible only to site
* admins.
* - title_attributes: Same as attributes, except applied to the main title
* tag that appears in the template.
* - content_attributes: Same as attributes, except applied to the main
* content tag that appears in the template.
* - author_attributes: Same as attributes, except applied to the author of
* the node tag that appears in the template.
* - title_prefix: Additional output populated by modules, intended to be
* displayed in front of the main title tag that appears in the template.
* - title_suffix: Additional output populated by modules, intended to be
* displayed after the main title tag that appears in the template.
* - view_mode: View mode; for example, "teaser" or "full".
* - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'.
* - page: Flag for the full page state. Will be true if view_mode is 'full'.
* - readmore: Flag for more state. Will be true if the teaser content of the
* node cannot hold the main body content.
* - 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.
*
* @see template_preprocess_node()
*
* @todo Remove the id attribute (or make it a class), because if that gets
* rendered twice on a page this is invalid CSS for example: two lists
* in different view modes.
*/
#}
<article {{ bem("node") }}>
{{ title_prefix }}
<h2>{{ label }}</h2>
{{ title_suffix }}
{% if display_submitted %}
<footer>
{{ author_picture }}
<div{{ author_attributes }}>
{% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}
{{ metadata }}
</div>
</footer>
{% endif %}
<div{{ content_attributes }}>
{{ content }}
</div>
</article>
+20
View File
@@ -0,0 +1,20 @@
{#
/**
* @file
* Theme override for page titles.
*
* Available variables:
* - title_attributes: HTML attributes for the page title element.
* - title_prefix: Additional output populated by modules, intended to be
* displayed in front of the main title tag that appears in the template.
* - title: The page title, for use in the actual content.
* - title_suffix: Additional output populated by modules, intended to be
* displayed after the main title tag that appears in the template.
*/
#}
{{ title_prefix }}
{% if title %}
<h1>{{ title }}</h1>
{% endif %}
{{ title_suffix }}
+109
View File
@@ -0,0 +1,109 @@
{#
/**
* @file
* Theme override to display a table.
*
* Available variables:
* - attributes: HTML attributes to apply to the <table> tag.
* - caption: A localized string for the <caption> tag.
* - colgroups: Column groups. Each group contains the following properties:
* - attributes: HTML attributes to apply to the <col> tag.
* Note: Drupal currently supports only one table header row, see
* https://www.drupal.org/node/893530 and
* http://api.drupal.org/api/drupal/includes!theme.inc/function/theme_table/7#comment-5109.
* - header: Table header cells. Each cell contains the following properties:
* - tag: The HTML tag name to use; either 'th' or 'td'.
* - attributes: HTML attributes to apply to the tag.
* - content: A localized string for the title of the column.
* - field: Field name (required for column sorting).
* - sort: Default sort order for this column ("asc" or "desc").
* - sticky: A flag indicating whether to use a "sticky" table header.
* - rows: Table rows. Each row contains the following properties:
* - attributes: HTML attributes to apply to the <tr> tag.
* - data: Table cells.
* - no_striping: A flag indicating that the row should receive no
* 'even / odd' styling. Defaults to FALSE.
* - cells: Table cells of the row. Each cell contains the following keys:
* - tag: The HTML tag name to use; either 'th' or 'td'.
* - attributes: Any HTML attributes, such as "colspan", to apply to the
* table cell.
* - content: The string to display in the table cell.
* - active_table_sort: A boolean indicating whether the cell is the active
table sort.
* - footer: Table footer rows, in the same format as the rows variable.
* - empty: The message to display in an extra row if table does not have
* any rows.
* - no_striping: A boolean indicating that the row should receive no striping.
* - header_columns: The number of columns in the header.
*
* @see template_preprocess_table()
*/
#}
<table{{ attributes.addClass('table') }}>
{% if caption %}
<caption>{{ caption }}</caption>
{% endif %}
{% for colgroup in colgroups %}
{% if colgroup.cols %}
<colgroup{{ colgroup.attributes }}>
{% for col in colgroup.cols %}
<col{{ col.attributes }} />
{% endfor %}
</colgroup>
{% else %}
<colgroup{{ colgroup.attributes }} />
{% endif %}
{% endfor %}
{% if header %}
<thead>
<tr>
{% for cell in header %}
<{{ cell.tag }}{{ cell.attributes.addClass('table__heading-cell') }}>
{{- cell.content -}}
</{{ cell.tag }}>
{% endfor %}
</tr>
</thead>
{% endif %}
{% if rows %}
<tbody>
{% for row in rows %}
<tr{{ row.attributes.addClass('table__row') }}>
{% for cell in row.cells %}
<{{ cell.tag }}{{ cell.attributes.addClass('table__cell') }}>
{{- cell.content -}}
</{{ cell.tag }}>
{% endfor %}
</tr>
{% endfor %}
</tbody>
{% elseif empty %}
<tbody>
<tr class="table__row">
<td colspan="{{ header_columns }}" class="table__cell">{{ empty }}</td>
</tr>
</tbody>
{% endif %}
{% if footer %}
<tfoot>
{% for row in footer %}
<tr{{ row.attributes }}>
{%
set footer_cell_classes = [
'table__heading-cell',
'table__footer-cell',
]
%}
{% for cell in row.cells %}
<{{ cell.tag }}{{ cell.attributes.addClass(footer_cell_classes) }}>
{{- cell.content -}}
</{{ cell.tag }}>
{% endfor %}
</tr>
{% endfor %}
</tfoot>
{% endif %}
</table>