Skip to content
Snippets Groups Projects
Commit 236971c2 authored by Kevin Paxman's avatar Kevin Paxman
Browse files

Merge branch 'feature/ISTWCMS-5413-ebremner-bibcite-blocks' into '1.0.x'

ISTWCMS-5413: adding template for bibcite reference table

See merge request !71
parents 4dc10d52 30cd530d
No related branches found
No related tags found
1 merge request!71ISTWCMS-5413: adding template for bibcite reference table
{#
/**
* @file
* Theme override for a field.
*/
#}
{%
set classes = [
'uw-field',
'uw-field--name-' ~ field_name|clean_class,
'uw-field--type-' ~ field_type|clean_class,
'uw-field--label-' ~ label_display,
]
%}
{%
set title_classes = [
'uw-field__label',
label_display == 'visually_hidden' ? 'visually-hidden',
]
%}
{% for item in items %}{% if loop.index0 > 0 %},&nbsp;{% endif %}<a href="{{ file_url(item.content['#file'].uri.value) }}">{{ item.content['#file'].filename.value }}</a>{% endfor %}
{#
/**
* @file bibcite-reference-table.html.twig
* Theme implementation to present Reference data in table.
*
* Available variables:
* - 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.
* - content: All reference 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 container element.
* - bibcite_reference: The bibcite_reference entity with limited access to object properties and methods.
* - view_mode: View mode; for example, "teaser" or "full".
* - rows: Data rows.
*
* @see template_preprocess_bibcite_reference_table()
*
* @ingroup themeable
*/
#}
{% set new_rows = [] %}
{% set related_files = [] %}
{% set links = [] %}
{% for row in rows %}
{% if row.element['#field_name'] == 'related_files' %}
{% set related_files = row %}
{% elseif row.element.links %}
{% set links = row %}
{% else %}
{% set new_rows = new_rows | merge([row]) %}
{% endif %}
{% endfor %}
{% if related_files | length > 0 %}
{% set new_rows = new_rows | merge([related_files]) %}
{% endif %}
{% if links | length > 0 %}
{% set new_rows = new_rows | merge([links]) %}
{% endif %}
{% set rows = new_rows %}
<div{{ attributes }}>
{{ title_prefix }}
{{ title_suffix }}
<table>
{% if rows %}
<tbody>
<tr{{ row.attributes.addClass(row_classes) }}>
<th scope="row">Title</th>
<td>{{ title }}</td>
</tr>
{% for row in rows %}
{% set row_classes = [
not no_striping ? cycle(['odd', 'even'], loop.index0),
] %}
<tr{{ row.attributes.addClass(row_classes) }}>
<th scope="row">{{- row.title -}}</th>
<td>{{- row.element -}}</td>
</tr>
{% endfor %}
</tbody>
{% endif %}
</table>
</div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment