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