diff --git a/core/includes/common.inc b/core/includes/common.inc
index 2b3b6327e84ac816bbcb49748881458cb38f9828..8b9d9e3d11d39a7754c03ae8b3bb6f08f868f51c 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -4994,14 +4994,14 @@ function drupal_pre_render_link($element) {
*
* In this example, the links are grouped by functionality, which can be
* helpful to themers who want to display certain kinds of links independently.
- * For example, adding this code to node.tpl.php will result in the comment
+ * For example, adding this code to node.html.twig will result in the comment
* links being rendered as a single list:
* @code
* print render($content['links']['comment']);
* @endcode
*
* (where $node->content has been transformed into $content before handing
- * control to the node.tpl.php template).
+ * control to the node.html.twig template).
*
* The pre_render function defined here allows the above flexibility, but also
* allows the following code to be used to render all remaining links into a
diff --git a/core/includes/entity.api.php b/core/includes/entity.api.php
index 148f11dd8cb11097b043f195f99cbb125ee883bc..1912fe172748750e67566097c524e83dcb46ed2b 100644
--- a/core/includes/entity.api.php
+++ b/core/includes/entity.api.php
@@ -344,7 +344,7 @@ function hook_entity_view(\Drupal\Core\Entity\EntityInterface $entity, \Drupal\e
* If a module wishes to act on the rendered HTML of the entity rather than the
* structured content array, it may use this hook to add a #post_render
* callback. Alternatively, it could also implement hook_preprocess_HOOK() for
- * the particular entity type template, if there is one (e.g., node.tpl.php).
+ * the particular entity type template, if there is one (e.g., node.html.twig).
* See drupal_render() and theme() for details.
*
* @param $build
diff --git a/core/modules/edit/edit.module b/core/modules/edit/edit.module
index 6a73d8976d12110a17427aed9faf6e87c7f9efd1..7e1d1fe0c11e23df1b15600edadca91f1f4976ac 100644
--- a/core/modules/edit/edit.module
+++ b/core/modules/edit/edit.module
@@ -137,7 +137,7 @@ function edit_preprocess_field(&$variables) {
}
/**
- * Implements hook_preprocess_HOOK() for node.tpl.php.
+ * Implements hook_preprocess_HOOK() for node.html.twig.
*
* @todo Remove this, handle in generic way: http://drupal.org/node/1972514.
*/
diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module
index 75e0a223c4db270b0d4f70d21acee7377a60d75c..31fd0fc4f9d35ec4dd16e7728e49c4b102572824 100644
--- a/core/modules/locale/locale.module
+++ b/core/modules/locale/locale.module
@@ -870,7 +870,7 @@ function locale_system_file_system_settings_submit(&$form, $form_state) {
}
/**
- * Implements hook_preprocess_HOOK() for node.tpl.php.
+ * Implements hook_preprocess_HOOK() for node.html.twig.
*/
function locale_preprocess_node(&$variables) {
if ($variables['node']->langcode != LANGUAGE_NOT_SPECIFIED) {
diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php
index 78a313971cca63572dee02fcc1db396dfa826190..b6cd02448b26f51197bd202f5b383202c1b3af31 100644
--- a/core/modules/node/node.api.php
+++ b/core/modules/node/node.api.php
@@ -898,8 +898,8 @@ function hook_node_view(\Drupal\Core\Entity\EntityInterface $node, \Drupal\entit
* If the module wishes to act on the rendered HTML of the node rather than the
* structured content array, it may use this hook to add a #post_render
* callback. Alternatively, it could also implement hook_preprocess_HOOK() for
- * node.tpl.php. See drupal_render() and theme() documentation respectively for
- * details.
+ * node.html.twig. See drupal_render() and theme() documentation respectively
+ * for details.
*
* @param $build
* A renderable array representing the node content.
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 5c934df6aebd8077ec7e77e0572324989222b7fb..23bf4be000e0c40b1352ceee9dcf43efa85f6db2 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -174,7 +174,6 @@ function node_theme() {
),
'node_edit_form' => array(
'render element' => 'form',
- 'path' => drupal_get_path('module', 'node') . '/templates',
'template' => 'node-edit-form',
),
);
@@ -1091,19 +1090,19 @@ function node_preprocess_block(&$variables) {
}
/**
- * Processes variables for node.tpl.php.
+ * Prepares variables for node templates.
*
- * Most themes utilize their own copy of node.tpl.php. The default is located
- * inside "modules/node/node.tpl.php". Look in there for the full list of
- * variables.
+ * Default template: node.html.twig.
*
- * @param $variables
+ * Most themes utilize their own copy of node.html.twig. The default is located
+ * inside "/core/modules/node/templates/node.html.twig". Look in there for the full
+ * list of variables.
+ *
+ * @param array $variables
* An associative array containing:
* - elements: An array of elements to display in view mode.
* - node: The node object.
* - view_mode: View mode; e.g., 'full', 'teaser'...
- *
- * @see node.tpl.php
*/
function template_preprocess_node(&$variables) {
$variables['view_mode'] = $variables['elements']['#view_mode'];
@@ -1112,25 +1111,18 @@ function template_preprocess_node(&$variables) {
$variables['node'] = $variables['elements']['#node'];
$node = $variables['node'];
- $variables['date'] = format_date($node->created);
- $variables['name'] = theme('username', array(
+ $variables['date'] = format_date($node->created);
+ // @todo Change 'name' to 'author' and also convert to a render array pending
+ // http://drupal.org/node/1941286.
+ $variables['name'] = theme('username', array(
'account' => $node,
'link_attributes' => array('rel' => 'author'),
));
$uri = $node->uri();
$variables['node_url'] = url($uri['path'], $uri['options']);
- $variables['label'] = check_plain($node->label());
- $variables['page'] = $variables['view_mode'] == 'full' && node_is_page($node);
-
- // Make useful flags and node data available.
- // @todo: The comment properties only exist if comment.module is enabled, but
- // are documented in node.tpl.php, so we make sure that they are set.
- // Consider removing them.
- $properties = array('type', 'comment_count', 'uid', 'created', 'promote', 'sticky', 'status', 'comment');
- foreach ($properties as $property) {
- $variables[$property] = isset($node->$property) ? $node->$property : NULL;
- }
+ $variables['label'] = check_plain($node->label());
+ $variables['page'] = $variables['view_mode'] == 'full' && node_is_page($node);
// Helpful $content variable for templates.
$variables += array('content' => array());
@@ -1186,6 +1178,8 @@ function template_preprocess_node(&$variables) {
// Clean up name so there are no underscores.
$variables['theme_hook_suggestions'][] = 'node__' . $node->type;
$variables['theme_hook_suggestions'][] = 'node__' . $node->nid;
+
+ $variables['content_attributes']['class'][] = 'content';
}
/**
diff --git a/core/modules/node/templates/node-edit-form.html.twig b/core/modules/node/templates/node-edit-form.html.twig
new file mode 100644
index 0000000000000000000000000000000000000000..eee9ecc1626ca75d6514d72f1f1bb42098cf8650
--- /dev/null
+++ b/core/modules/node/templates/node-edit-form.html.twig
@@ -0,0 +1,30 @@
+{#
+/**
+ * @file
+ * Two column template for the node add/edit form.
+ *
+ * This template will be used when a node edit form specifies 'node_edit_form'
+ * as its #theme callback. Otherwise, by default, node add/edit forms will be
+ * themed by theme_form().
+ *
+ * Available variables:
+ * - form: The node add/edit form.
+ *
+ * @see seven_form_node_form_alter()
+ *
+ * @ingroup themeable
+ */
+#}
+{% hide(form.advanced) %}
+{% hide(form.actions) %}
+
diff --git a/core/modules/node/templates/node-edit-form.tpl.php b/core/modules/node/templates/node-edit-form.tpl.php
deleted file mode 100644
index 7b766839078b61c053ea7c166f061c8aeb93a508..0000000000000000000000000000000000000000
--- a/core/modules/node/templates/node-edit-form.tpl.php
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig
index 0b3a32281bd27679c304f795b34bf184e36717f0..d28b88021cafcca00451eb5e50dbdf899aedcc7c 100644
--- a/core/modules/node/templates/node.html.twig
+++ b/core/modules/node/templates/node.html.twig
@@ -4,8 +4,25 @@
* Default theme implementation to display a node.
*
* Available variables:
- * - label: the title of the node.
- * - content: node items. Use {{ content }} to print them all,
+ * - node: Full node entity.
+ * - type: The type of the node, for example, "page" or "article".
+ * - uid: The user ID of the node author.
+ * - created: Formatted creation date. Preprocess functions can reformat it by
+ * calling format_date() with the desired parameters on
+ * $variables['node']->created.
+ * - promote: Whether the node is promoted to the front page.
+ * - sticky: Whether the node is 'sticky'. Sticky nodes are ordered above
+ * other non-sticky nodes in teaser listings
+ * - status: Whether the node is published.
+ * - comment: A value representing the comment status of the current node. May
+ * be one of the following:
+ * - 0: The comment form and any existing comments are hidden.
+ * - 1: Comments are closed. No new comments may be posted, but existing
+ * comments are displayed.
+ * - 2: Comments are open on this node.
+ * - comment_count: Number of comments attached to the node.
+ * - 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
* {% hide(content.field_example) %} to temporarily suppress the printing
* of a given element.
@@ -18,40 +35,28 @@
* - display_submitted: Whether submission information should be displayed.
* - submitted: Submission information created from name and date during
* template_preprocess_node().
- * - attributes: HTML attributes for the surrounding element.
- * Attributes include the 'class' information, which contains:
- * - node: The current template type; for example, "theming hook".
+ * - 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]: The current node type. For example, if the node is a
* "Article" it would result in "node-article". Note that the machine
* name will often be in a short form of the human readable label.
- * - view-mode-[view_mode]: The View Mode of the node; for example, "teaser"
- * or "full".
- * - preview: Nodes in preview mode.
+ * - view-mode-[view_mode]: The View Mode of the node; for example, a teaser
+ * would result in: "view-mode-teaser", and full: "view-mode-full".
+ * - preview: Whether a node is in preview mode.
* The following are controlled through the node publishing options.
- * - promoted: Nodes promoted to the front page.
- * - sticky: Nodes ordered above other non-sticky nodes in teaser
+ * - promoted: Appears on nodes promoted to the front page.
+ * - sticky: Appears on nodes ordered above other non-sticky nodes in teaser
* listings.
- * - unpublished: Unpublished nodes visible only to administrators.
+ * - unpublished: Appears on unpublished nodes visible only to site admins.
* - 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.
- *
- * Other variables:
- * - node: Fully loaded node entity.
- * - type: Node type; for example, page, article, etc.
- * - comment_count: Number of comments attached to the node.
- * - uid: User ID of the node author.
- * - created: Time the node was published formatted as a Unix timestamp.
- *
- * Node status variables:
* - 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'.
- * - promote: Flag for front page promotion state.
- * - sticky: Flag for sticky post setting.
- * - status: Flag for published status.
- * - comment: State of comment settings for the node.
* - readmore: Flag for more state. Will be true if the teaser content of the
* node cannot hold the main body content.
* - is_front: Flag for front. Will be true when presented on the front page.
@@ -60,16 +65,20 @@
* - is_admin: Flag for admin user status. Will be true when the current user
* is an administrator.
*
- * Field variables: for each field instance attached to the node a corresponding
- * variable is defined; for example, $node->body becomes body. When needing to
+ * In field variables, each field instance attached to the node a corresponding
+ * variable is defined; for example, 'node.body' becomes 'body'. When needing to
* access a field's raw values, developers/themers are strongly encouraged to
* use these variables. Otherwise they will have to explicitly specify the
- * desired field language; for example, $node->body['en'], thus overriding any
- * language negotiation rule that was previously applied.
+ * desired field language; for example, 'node.body.en', thus overriding any
+ * language negotiation rule that may have been applied previously.
*
* @see template_preprocess()
* @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.
+ *
* @ingroup themeable
*/
#}
@@ -90,7 +99,7 @@
{% endif %}
-
+
{# We hide the comments and links now so that we can render them later. #}
{% hide(content.comments) %}
{% hide(content.links) %}
diff --git a/core/modules/node/templates/node.tpl.php b/core/modules/node/templates/node.tpl.php
deleted file mode 100644
index 35cd730475b379a51cf6dd8091abb779b7987169..0000000000000000000000000000000000000000
--- a/core/modules/node/templates/node.tpl.php
+++ /dev/null
@@ -1,103 +0,0 @@
-body becomes $body. When needing to
- * access a field's raw values, developers/themers are strongly encouraged to
- * use these variables. Otherwise they will have to explicitly specify the
- * desired field language; for example, $node->body['en'], thus overriding any
- * language negotiation rule that was previously applied.
- *
- * @see template_preprocess()
- * @see template_preprocess_node()
- * @see template_process()
- *
- * @ingroup themeable
- */
-?>
-
>
-
-
-
- >
-
-
-
-
-
-
-
- >
-
-
-
-
-
-
-
diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module
index 3783f6bcaadcce310f9f094d0dd86b9ee977ded3..aaea6bbb016c4782a39b8a9e6608e119c2b428a5 100644
--- a/core/modules/rdf/rdf.module
+++ b/core/modules/rdf/rdf.module
@@ -492,7 +492,7 @@ function rdf_preprocess_html(&$variables) {
}
/**
- * Implements hook_preprocess_HOOK() for node.tpl.php.
+ * Implements hook_preprocess_HOOK() for node.html.twig.
*/
function rdf_preprocess_node(&$variables) {
// Adds RDFa markup to the node container. The about attribute specifies the
@@ -509,7 +509,7 @@ function rdf_preprocess_node(&$variables) {
$variables['title_attributes']['property'] = empty($variables['node']->rdf_mapping['title']['predicates']) ? NULL : $variables['node']->rdf_mapping['title']['predicates'];
$variables['title_attributes']['datatype'] = '';
- // In full node mode, the title is not displayed by node.tpl.php so it is
+ // In full node mode, the title is not displayed by node.html.twig so it is
// added in the tag of the HTML page.
if ($variables['page']) {
$element = array(
@@ -557,7 +557,7 @@ function rdf_preprocess_node(&$variables) {
$variables['content']['links']['comment']['#links']['comment-comments']['attributes'] += $comment_count_attributes;
}
// In full node view, the number of comments is not displayed by
- // node.tpl.php so it is expressed in RDFa in the tag of the HTML
+ // node.html.twig so it is expressed in RDFa in the tag of the HTML
// page.
if ($variables['page'] && user_access('access comments')) {
$element = array(
@@ -843,8 +843,8 @@ function rdf_preprocess_image(&$variables) {
* - context: An array of context information about the content to be wrapped:
* - hook: The theme hook that will use the wrapped content. This
* corresponds to the key within the theme registry for this template.
- * For example, if this content is about to be used in node.tpl.php or
- * node-[type].tpl.php, then the 'hook' is 'node'.
+ * For example, if this content is about to be used in node.html.twig or
+ * node-[type].html.twig, then the 'hook' is 'node'.
* - variable_name: The name of the variable by which the template will
* refer to this content. Each template file has documentation about
* the variables it uses. For example, if this function is called in