annotate themes/isobartik/templates/node.html.twig @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents e11175134f4e
children
rev   line source
Chris@3 1 {#
Chris@3 2 /**
Chris@3 3 * @file
Chris@3 4 * Bartik's theme implementation to display a node.
Chris@3 5 *
Chris@3 6 * Available variables:
Chris@3 7 * - node: The node entity with limited access to object properties and methods.
Chris@3 8 * Only method names starting with "get", "has", or "is" and a few common
Chris@3 9 * methods such as "id", "label", and "bundle" are available. For example:
Chris@3 10 * - node.getCreatedTime() will return the node creation timestamp.
Chris@3 11 * - node.hasField('field_example') returns TRUE if the node bundle includes
Chris@3 12 * field_example. (This does not indicate the presence of a value in this
Chris@3 13 * field.)
Chris@3 14 * - node.isPublished() will return whether the node is published or not.
Chris@3 15 * Calling other methods, such as node.delete(), will result in an exception.
Chris@3 16 * See \Drupal\node\Entity\Node for a full list of public properties and
Chris@3 17 * methods for the node object.
Chris@3 18 * - label: The title of the node.
Chris@3 19 * - content: All node items. Use {{ content }} to print them all,
Chris@3 20 * or print a subset such as {{ content.field_example }}. Use
Chris@3 21 * {{ content|without('field_example') }} to temporarily suppress the printing
Chris@3 22 * of a given child element.
Chris@3 23 * - author_picture: The node author user entity, rendered using the "compact"
Chris@3 24 * view mode.
Chris@3 25 * - metadata: Metadata for this node.
Chris@3 26 * - date: Themed creation date field.
Chris@3 27 * - author_name: Themed author name field.
Chris@3 28 * - url: Direct URL of the current node.
Chris@3 29 * - display_submitted: Whether submission information should be displayed.
Chris@3 30 * - attributes: HTML attributes for the containing element.
Chris@3 31 * The attributes.class element may contain one or more of the following
Chris@3 32 * classes:
Chris@3 33 * - node: The current template type (also known as a "theming hook").
Chris@3 34 * - node--type-[type]: The current node type. For example, if the node is an
Chris@3 35 * "Article" it would result in "node--type-article". Note that the machine
Chris@3 36 * name will often be in a short form of the human readable label.
Chris@3 37 * - node--view-mode-[view_mode]: The View Mode of the node; for example, a
Chris@3 38 * teaser would result in: "node--view-mode-teaser", and
Chris@3 39 * full: "node--view-mode-full".
Chris@3 40 * The following are controlled through the node publishing options.
Chris@3 41 * - node--promoted: Appears on nodes promoted to the front page.
Chris@3 42 * - node--sticky: Appears on nodes ordered above other non-sticky nodes in
Chris@3 43 * teaser listings.
Chris@3 44 * - node--unpublished: Appears on unpublished nodes visible only to site
Chris@3 45 * admins.
Chris@3 46 * - title_attributes: Same as attributes, except applied to the main title
Chris@3 47 * tag that appears in the template.
Chris@3 48 * - content_attributes: Same as attributes, except applied to the main
Chris@3 49 * content tag that appears in the template.
Chris@3 50 * - author_attributes: Same as attributes, except applied to the author of
Chris@3 51 * the node tag that appears in the template.
Chris@3 52 * - title_prefix: Additional output populated by modules, intended to be
Chris@3 53 * displayed in front of the main title tag that appears in the template.
Chris@3 54 * - title_suffix: Additional output populated by modules, intended to be
Chris@3 55 * displayed after the main title tag that appears in the template.
Chris@3 56 * - view_mode: View mode; for example, "teaser" or "full".
Chris@3 57 * - teaser: Flag for the teaser state. Will be true if view_mode is 'teaser'.
Chris@3 58 * - page: Flag for the full page state. Will be true if view_mode is 'full'.
Chris@3 59 * - readmore: Flag for more state. Will be true if the teaser content of the
Chris@3 60 * node cannot hold the main body content.
Chris@3 61 * - logged_in: Flag for authenticated user status. Will be true when the
Chris@3 62 * current user is a logged-in member.
Chris@3 63 * - is_admin: Flag for admin user status. Will be true when the current user
Chris@3 64 * is an administrator.
Chris@3 65 *
Chris@3 66 * @see template_preprocess_node()
Chris@3 67 */
Chris@3 68 #}
Chris@3 69 {%
Chris@3 70 set classes = [
Chris@3 71 'node',
Chris@3 72 'node--type-' ~ node.bundle|clean_class,
Chris@3 73 node.isPromoted() ? 'node--promoted',
Chris@3 74 node.isSticky() ? 'node--sticky',
Chris@3 75 not node.isPublished() ? 'node--unpublished',
Chris@3 76 view_mode ? 'node--view-mode-' ~ view_mode|clean_class,
Chris@3 77 'clearfix',
Chris@3 78 ]
Chris@3 79 %}
Chris@3 80 {{ attach_library('classy/node') }}
Chris@3 81 <article{{ attributes.addClass(classes) }}>
Chris@3 82 <header>
Chris@3 83 {{ title_prefix }}
Chris@3 84 {% if not page %}
Chris@3 85 <h2{{ title_attributes.addClass('node__title') }}>
Chris@3 86 <a href="{{ url }}" rel="bookmark">{{ label }}</a>
Chris@3 87 </h2>
Chris@3 88 {% endif %}
Chris@3 89 {{ title_suffix }}
Chris@3 90 {% if display_submitted %}
Chris@3 91 <div class="node__meta">
Chris@3 92 {{ author_picture }}
Chris@3 93 <span{{ author_attributes }}>
Chris@3 94 {% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}
Chris@3 95 </span>
Chris@3 96 {{ metadata }}
Chris@3 97 </div>
Chris@3 98 {% endif %}
Chris@3 99 </header>
Chris@3 100 <div{{ content_attributes.addClass('node__content', 'clearfix') }}>
Chris@3 101 {{ content }}
Chris@3 102 </div>
Chris@3 103 </article>