-
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.
- Loading branch information
Showing
3 changed files
with
308 additions
and
0 deletions.
There are no files selected for viewing
192 changes: 192 additions & 0 deletions
192
templates/content/node--ubc-publication--full.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,192 @@ | ||
{# | ||
/** | ||
* @file | ||
* Theme override to display a node. | ||
* | ||
* Available variables: | ||
* - node: Full node entity. | ||
* - id: The node ID. | ||
* - bundle: The type of the node, for example, "page" or "article". | ||
* - authorid: The user ID of the node author. | ||
* - createdtime: Time the node was published formatted in Unix timestamp. | ||
* - changedtime: Time the node was changed formatted in Unix timestamp. | ||
* - 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. | ||
*/ | ||
#} | ||
{% set meta_attributes = create_attribute() %} | ||
{% set link_attributes = create_attribute() %} | ||
|
||
{% | ||
set classes = [ | ||
'node', | ||
'node--type-' ~ node.bundle|clean_class, | ||
node.isPromoted() ? 'node--promoted', | ||
node.isSticky() ? 'node--sticky', | ||
not node.isPublished() ? 'node--unpublished', | ||
view_mode ? 'node--view-mode-' ~ view_mode|clean_class, | ||
] | ||
%} | ||
{% | ||
set meta_classes = [ | ||
'node__meta', | ||
'mt-2', | ||
'text-sm', | ||
'text-grey-700', | ||
] | ||
%} | ||
{% | ||
set content_classes = [ | ||
'flow-root', | ||
'text-formatted', | ||
'node__content', | ||
] | ||
%} | ||
{% | ||
set link_classes = [ | ||
'unit-button', | ||
'unit-button--simple', | ||
] | ||
%} | ||
|
||
{% set date = node.createdtime|format_date('date_readable') %} | ||
{% set firstname = node.Owner.field_user_first_name.value %} | ||
{% set lastname = node.Owner.field_user_last_name.value %} | ||
{% set author_name = [firstname, lastname]|join(' ') %} | ||
{% if not (node.field_publication_link.isEmpty == true) and content.field_publication_link is defined %} | ||
{% set exturl = content.field_publication_link[0]['#url']|raw %} | ||
{% set exttitle = content.field_publication_link[0]['#title']|raw %} | ||
{% set link_target = '_blank' %} | ||
{% endif %} | ||
|
||
<article{{ attributes.addClass(classes) }}> | ||
{{ title_prefix }} | ||
{% if not page %} | ||
<h2{{ title_attributes }}> | ||
<a href="{{ url }}" rel="bookmark">{{ label }}</a> | ||
</h2> | ||
{% endif %} | ||
{{ title_suffix }} | ||
{% if display_submitted %} | ||
<div{{ meta_attributes.addClass(meta_classes) }}> | ||
{{ author_picture }} | ||
<div{{ author_attributes.addClass('node__submitted') }}> | ||
{% trans %}Posted on {{ date }}{% endtrans %} | ||
</div> | ||
</div> | ||
{% endif %} | ||
<div{{ content_attributes.addClass(content_classes) }}> | ||
{% if not node.isPublished() %} | ||
<div class="unpublished">Unpublished</div> | ||
{% endif %} | ||
{% if not (node.field_publication_image.isEmpty == true) and content.field_publication_image is defined %} | ||
<figure class="my-6">{{ content.field_publication_image.0 }}</figure> | ||
{% endif %} | ||
{% if not (node.field_publication_lead.isEmpty == true) and content.field_publication_lead is defined %} | ||
<p><strong>Project Lead</strong></p> | ||
<p class="mt-0">{{ content.field_publication_lead.0 }}</p> | ||
{% endif %} | ||
{% if not (node.field_publication_researchers.isEmpty == true) and content.field_publication_researchers is defined %} | ||
<p><strong>Researcher(s)</strong></p> | ||
<p class="mt-0"> | ||
{%- for tag in node.field_publication_researchers -%}<a href="{{ path('entity.node.canonical', {'node': tag.entity.id}) }}">{{- tag.entity.title.value -}}</a>{% if loop.last == false %}, {% endif %} | ||
{%- endfor -%}</p> | ||
{% endif %} | ||
{% if not (node.field_publication_journal.isEmpty == true) and content.field_publication_journal is defined %} | ||
<p><strong>Journal</strong></p> | ||
<p class="mt-0">{{ content.field_publication_journal.0 }}</p> | ||
{% endif %} | ||
{% if not (node.field_publication_year.isEmpty == true) and content.field_publication_year is defined %} | ||
<p><strong>Date of Publication</strong></p> | ||
<p class="mt-0">{{ content.field_publication_year.0 }}</p> | ||
{% endif %} | ||
{% if not (node.field_publication_description.isEmpty == true) and content.field_publication_description is defined %} | ||
<p><strong>Description</strong></p> | ||
<div class="first-child--mt-0">{{ content.field_publication_description.0 }}</div> | ||
{% endif %} | ||
{% if not (node.body.isEmpty == true) and content.body is defined %} | ||
<p><strong>Details</strong></p> | ||
<div class="first-child--mt-0">{{ content.body.0 }}</div> | ||
{% endif %} | ||
{% if not (node.field_publication_link.isEmpty == true) and content.field_publication_link is defined %} | ||
<p><strong>External Link</strong></p> | ||
<p class="mt-0"><a{{ link_attributes.addClass(link_classes).setAttribute('target', link_target) }} href="{{ exturl }}" rel="bookmark">Read the Research Paper</a></p> | ||
{% endif %} | ||
{% if not (node.field_publication_projects.isEmpty == true) and content.field_publication_projects is defined %} | ||
<p><strong>Related Projects</strong></p> | ||
<p class="mt-0"> | ||
{%- for tag in node.field_publication_projects -%}<a href="{{ path('entity.node.canonical', {'node': tag.entity.id}) }}">{{- tag.entity.title.value -}}</a>{% if loop.last == false %}, {% endif %} | ||
{%- endfor -%}</p> | ||
{% endif %} | ||
{{ content|without( | ||
'field_publication_projects', | ||
'field_publication_year', | ||
'field_publication_lead', | ||
'field_publication_description', | ||
'field_publication_researchers', | ||
'field_publication_link', | ||
'field_publication_image', | ||
'field_publication_type', | ||
'field_publication_journal', | ||
'field_publication_research_area', | ||
'body', | ||
'links') }} | ||
<hr /> | ||
{% if (not (node.field_publication_type.isEmpty == true) and content.field_publication_type is defined) or (not (node.field_publication_research_area.isEmpty == true) and content.field_publication_research_area is defined) %} | ||
<div class="flex flex-wrap mt-4 tags"> | ||
{{ content.field_publication_type }}{{ content.field_publication_research_area }} | ||
</div> | ||
{% endif %} | ||
</div> | ||
</article> |
58 changes: 58 additions & 0 deletions
58
templates/field/field--field-publication-research-area.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,58 @@ | ||
{# | ||
/** | ||
* @file | ||
* Theme override for a field. | ||
* | ||
* To override output, copy the "field.html.twig" from the templates directory | ||
* to your theme's directory and customize it, just like customizing other | ||
* Drupal templates such as page.html.twig or node.html.twig. | ||
* | ||
* Instead of overriding the theming for all fields, you can also just override | ||
* theming for a subset of fields using | ||
* @link themeable Theme hook suggestions. @endlink For example, | ||
* here are some theme hook suggestions that can be used for a field_foo field | ||
* on an article node type: | ||
* - field--node--field-foo--article.html.twig | ||
* - field--node--field-foo.html.twig | ||
* - field--node--article.html.twig | ||
* - field--field-foo.html.twig | ||
* - field--text-with-summary.html.twig | ||
* - field.html.twig | ||
* | ||
* Available variables: | ||
* - attributes: HTML attributes for the containing element. | ||
* - label_hidden: Whether to show the field label or not. | ||
* - title_attributes: HTML attributes for the title. | ||
* - label: The label for the field. | ||
* - multiple: TRUE if a field can contain multiple items. | ||
* - items: List of all the field items. Each item contains: | ||
* - attributes: List of HTML attributes for each item. | ||
* - content: The field item's content. | ||
* - entity_type: The entity type to which the field belongs. | ||
* - field_name: The name of the field. | ||
* - field_type: The type of the field. | ||
* - label_display: The display settings for the label. | ||
* | ||
* | ||
* @see template_preprocess_field() | ||
*/ | ||
#} | ||
{% | ||
set title_classes = [ | ||
label_display == 'visually_hidden' ? 'visually-hidden', | ||
] | ||
%} | ||
|
||
{% if multiple %} | ||
<ul{{ attributes.addClass('inline-flex', 'list-none', 'pl-0') }}> | ||
{% for item in items %} | ||
<li{{ item.attributes.addClass('tag') }}>{{ item.content }}</li> | ||
{% endfor %} | ||
</ul> | ||
{% else %} | ||
{% for item in items %} | ||
<ul{{ attributes.addClass('inline-flex', 'list-none', 'pl-0') }}> | ||
<li{{ item.attributes.addClass('tag') }}>{{ item.content }}</li> | ||
</ul> | ||
{% endfor %} | ||
{% endif %} |
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,58 @@ | ||
{# | ||
/** | ||
* @file | ||
* Theme override for a field. | ||
* | ||
* To override output, copy the "field.html.twig" from the templates directory | ||
* to your theme's directory and customize it, just like customizing other | ||
* Drupal templates such as page.html.twig or node.html.twig. | ||
* | ||
* Instead of overriding the theming for all fields, you can also just override | ||
* theming for a subset of fields using | ||
* @link themeable Theme hook suggestions. @endlink For example, | ||
* here are some theme hook suggestions that can be used for a field_foo field | ||
* on an article node type: | ||
* - field--node--field-foo--article.html.twig | ||
* - field--node--field-foo.html.twig | ||
* - field--node--article.html.twig | ||
* - field--field-foo.html.twig | ||
* - field--text-with-summary.html.twig | ||
* - field.html.twig | ||
* | ||
* Available variables: | ||
* - attributes: HTML attributes for the containing element. | ||
* - label_hidden: Whether to show the field label or not. | ||
* - title_attributes: HTML attributes for the title. | ||
* - label: The label for the field. | ||
* - multiple: TRUE if a field can contain multiple items. | ||
* - items: List of all the field items. Each item contains: | ||
* - attributes: List of HTML attributes for each item. | ||
* - content: The field item's content. | ||
* - entity_type: The entity type to which the field belongs. | ||
* - field_name: The name of the field. | ||
* - field_type: The type of the field. | ||
* - label_display: The display settings for the label. | ||
* | ||
* | ||
* @see template_preprocess_field() | ||
*/ | ||
#} | ||
{% | ||
set title_classes = [ | ||
label_display == 'visually_hidden' ? 'visually-hidden', | ||
] | ||
%} | ||
|
||
{% if multiple %} | ||
<ul{{ attributes.addClass('inline-flex', 'list-none', 'pl-0') }}> | ||
{% for item in items %} | ||
<li{{ item.attributes.addClass('tag') }}>{{ item.content }}</li> | ||
{% endfor %} | ||
</ul> | ||
{% else %} | ||
{% for item in items %} | ||
<ul{{ attributes.addClass('inline-flex', 'list-none', 'pl-0') }}> | ||
<li{{ item.attributes.addClass('tag') }}>{{ item.content }}</li> | ||
</ul> | ||
{% endfor %} | ||
{% endif %} |