From 526501d01bc36242a8ddb148bf972796656ed8fa Mon Sep 17 00:00:00 2001 From: Scott Reeves Date: Tue, 26 Apr 2016 13:10:02 -0400 Subject: [PATCH] Issue #2610344 by mikeker, dimaro, mohit_aghera, andriyun, anil280988, Cottser, joelpittet: Re-add some documentation about what you can get from the node object in node.html.twig --- core/modules/node/templates/node.html.twig | 13 ++++++++++--- core/themes/bartik/templates/node.html.twig | 13 ++++++++++--- core/themes/classy/templates/content/node.html.twig | 13 ++++++++++--- core/themes/stable/templates/content/node.html.twig | 13 ++++++++++--- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index e7e353dfc3..c7ada1e54f 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -5,9 +5,16 @@ * * Available variables: * - node: The node entity with limited access to object properties and methods. - Only "getter" methods (method names starting with "get", "has", or "is") - and a few common methods such as "id" and "label" are available. Calling - other methods (such as node.delete) will result in an exception. + * Only method names starting with "get", "has", or "is" and a few common + * methods such as "id", "label", and "bundle" are available. For example: + * - node.getCreatedTime() will return the node creation timestamp. + * - node.hasField('field_example') returns TRUE if the node bundle includes + * field_example. (This does not indicate the presence of a value in this + * field.) + * - node.isPublished() will return whether the node is published or not. + * Calling other methods, such as node.delete(), will result in an exception. + * See \Drupal\node\Entity\Node for a full list of public properties and + * methods for the node object. * - 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 diff --git a/core/themes/bartik/templates/node.html.twig b/core/themes/bartik/templates/node.html.twig index 5d509aa558..b257ad3cb6 100644 --- a/core/themes/bartik/templates/node.html.twig +++ b/core/themes/bartik/templates/node.html.twig @@ -5,9 +5,16 @@ * * Available variables: * - node: The node entity with limited access to object properties and methods. - Only "getter" methods (method names starting with "get", "has", or "is") - and a few common methods such as "id" and "label" are available. Calling - other methods (such as node.delete) will result in an exception. + * Only method names starting with "get", "has", or "is" and a few common + * methods such as "id", "label", and "bundle" are available. For example: + * - node.getCreatedTime() will return the node creation timestamp. + * - node.hasField('field_example') returns TRUE if the node bundle includes + * field_example. (This does not indicate the presence of a value in this + * field.) + * - node.isPublished() will return whether the node is published or not. + * Calling other methods, such as node.delete(), will result in an exception. + * See \Drupal\node\Entity\Node for a full list of public properties and + * methods for the node object. * - 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 diff --git a/core/themes/classy/templates/content/node.html.twig b/core/themes/classy/templates/content/node.html.twig index 5af7c25fa3..7f99e796f6 100644 --- a/core/themes/classy/templates/content/node.html.twig +++ b/core/themes/classy/templates/content/node.html.twig @@ -5,9 +5,16 @@ * * Available variables: * - node: The node entity with limited access to object properties and methods. - Only "getter" methods (method names starting with "get", "has", or "is") - and a few common methods such as "id" and "label" are available. Calling - other methods (such as node.delete) will result in an exception. + * Only method names starting with "get", "has", or "is" and a few common + * methods such as "id", "label", and "bundle" are available. For example: + * - node.getCreatedTime() will return the node creation timestamp. + * - node.hasField('field_example') returns TRUE if the node bundle includes + * field_example. (This does not indicate the presence of a value in this + * field.) + * - node.isPublished() will return whether the node is published or not. + * Calling other methods, such as node.delete(), will result in an exception. + * See \Drupal\node\Entity\Node for a full list of public properties and + * methods for the node object. * - 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 diff --git a/core/themes/stable/templates/content/node.html.twig b/core/themes/stable/templates/content/node.html.twig index 68a92ea614..e9dcd0bc1c 100644 --- a/core/themes/stable/templates/content/node.html.twig +++ b/core/themes/stable/templates/content/node.html.twig @@ -5,9 +5,16 @@ * * Available variables: * - node: The node entity with limited access to object properties and methods. - Only "getter" methods (method names starting with "get", "has", or "is") - and a few common methods such as "id" and "label" are available. Calling - other methods (such as node.delete) will result in an exception. + * Only method names starting with "get", "has", or "is" and a few common + * methods such as "id", "label", and "bundle" are available. For example: + * - node.getCreatedTime() will return the node creation timestamp. + * - node.hasField('field_example') returns TRUE if the node bundle includes + * field_example. (This does not indicate the presence of a value in this + * field.) + * - node.isPublished() will return whether the node is published or not. + * Calling other methods, such as node.delete(), will result in an exception. + * See \Drupal\node\Entity\Node for a full list of public properties and + * methods for the node object. * - 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 -- GitLab