From 25419735738093da71db245c6c3c5a920aa723f4 Mon Sep 17 00:00:00 2001 From: Lee Rowlands Date: Thu, 28 Feb 2019 12:11:49 +1000 Subject: [PATCH] Issue #2923701 by AdamPS, jonathanshaw, Pancho, Jo Fitzgerald, alexpott, Berdir, plach, larowlan, Samvel, lauriii, eelkeblok, imclean, oriol_e9g: Mechanism to disable preprocessing of node base fields so they can be configured via the field UI --- core/modules/node/node.module | 68 ++++++++++++----- core/modules/node/templates/node.html.twig | 8 +- .../config/install/rdf.mapping.node.page.yml | 40 ++++++++++ .../node_display_configurable_test.info.yml | 6 ++ .../node_display_configurable_test.module | 28 +++++++ .../NodeDisplayConfigurableTest.php | 73 +++++++++++++++++++ core/modules/rdf/rdf.module | 21 +++++- .../content/node--article--full.html.twig | 8 +- .../content/node--card-common-alt.html.twig | 6 +- .../content/node--card-common.html.twig | 8 +- .../templates/content/node--card.html.twig | 8 +- .../content/node--recipe--full.html.twig | 8 +- .../umami/templates/content/node.html.twig | 28 +++---- core/themes/bartik/templates/node.html.twig | 8 +- .../classy/templates/content/node.html.twig | 8 +- 15 files changed, 265 insertions(+), 61 deletions(-) create mode 100644 core/modules/node/tests/modules/node_display_configurable_test/config/install/rdf.mapping.node.page.yml create mode 100644 core/modules/node/tests/modules/node_display_configurable_test/node_display_configurable_test.info.yml create mode 100644 core/modules/node/tests/modules/node_display_configurable_test/node_display_configurable_test.module create mode 100644 core/modules/node/tests/src/Functional/NodeDisplayConfigurableTest.php diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 59a64a14b3b..6fcaf2a6f29 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -602,11 +602,23 @@ function node_theme_suggestions_node(array $variables) { * inside "/core/modules/node/templates/node.html.twig". Look in there for the * full list of variables. * + * By default this function performs special preprocessing of some base fields + * so they are available as variables in the template. For example 'title' + * appears as 'label'. This preprocessing is skipped if: + * - a module makes the field's display configurable via the field UI by means + * of BaseFieldDefinition::setDisplayConfigurable() + * - AND the additional entity type property + * 'enable_base_field_custom_preprocess_skipping' has been set using + * hook_entity_type_build(). + * * @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', etc. + * + * @see hook_entity_type_build() + * @see \Drupal\Core\Field\BaseFieldDefinition::setDisplayConfigurable() */ function template_preprocess_node(&$variables) { $variables['view_mode'] = $variables['elements']['#view_mode']; @@ -615,14 +627,29 @@ function template_preprocess_node(&$variables) { $variables['node'] = $variables['elements']['#node']; /** @var \Drupal\node\NodeInterface $node */ $node = $variables['node']; - $variables['date'] = \Drupal::service('renderer')->render($variables['elements']['created']); - unset($variables['elements']['created']); - $variables['author_name'] = \Drupal::service('renderer')->render($variables['elements']['uid']); - unset($variables['elements']['uid']); + $skip_custom_preprocessing = $node->getEntityType()->get('enable_base_field_custom_preprocess_skipping'); + + // Make created, uid and title fields available separately. Skip this custom + // preprocessing if the field display is configurable and skipping has been + // enabled. + // @todo https://www.drupal.org/project/drupal/issues/3015623 + // In D9 delete this code and matching template lines. Using + // $variables['content'] is more flexible and consistent. + $submitted_configurable = $node->getFieldDefinition('created')->isDisplayConfigurable('view') || $node->getFieldDefinition('uid')->isDisplayConfigurable('view'); + if (!$skip_custom_preprocessing || !$submitted_configurable) { + $variables['date'] = \Drupal::service('renderer')->render($variables['elements']['created']); + unset($variables['elements']['created']); + $variables['author_name'] = \Drupal::service('renderer')->render($variables['elements']['uid']); + unset($variables['elements']['uid']); + } + + if (!$skip_custom_preprocessing || !$node->getFieldDefinition('title')->isDisplayConfigurable('view')) { + $variables['label'] = $variables['elements']['title']; + unset($variables['elements']['title']); + } $variables['url'] = !$node->isNew() ? $node->toUrl('canonical')->toString() : NULL; - $variables['label'] = $variables['elements']['title']; - unset($variables['elements']['title']); + // The 'page' variable is set to TRUE in two occasions: // - The view mode is 'full' and we are on the 'node.view' route. // - The node is in preview and view mode is either 'full' or 'default'. @@ -634,17 +661,24 @@ function template_preprocess_node(&$variables) { $variables['content'][$key] = $variables['elements'][$key]; } - // Display post information only on certain node types. - $node_type = $node->type->entity; - // Used by RDF to add attributes around the author and date submitted. - $variables['author_attributes'] = new Attribute(); - $variables['display_submitted'] = $node_type->displaySubmitted(); - if ($variables['display_submitted']) { - if (theme_get_setting('features.node_user_picture')) { - // To change user picture settings (e.g. image style), edit the 'compact' - // view mode on the User entity. Note that the 'compact' view mode might - // not be configured, so remember to always check the theme setting first. - $variables['author_picture'] = user_view($node->getOwner(), 'compact'); + if (isset($variables['date'])) { + // Display post information on certain node types. This only occurs if + // custom preprocessing occurred for both of the created and uid fields. + // @todo https://www.drupal.org/project/drupal/issues/3015623 + // In D9 delete this code and matching template lines. Using a field + // formatter is more flexible and consistent. + $node_type = $node->type->entity; + // Used by RDF to add attributes around the author and date submitted. + $variables['author_attributes'] = new Attribute(); + $variables['display_submitted'] = $node_type->displaySubmitted(); + if ($variables['display_submitted']) { + if (theme_get_setting('features.node_user_picture')) { + // To change user picture settings (e.g. image style), edit the + // 'compact' view mode on the User entity. Note that the 'compact' + // view mode might not be configured, so remember to always check the + // theme setting first. + $variables['author_picture'] = user_view($node->getOwner(), 'compact'); + } } } diff --git a/core/modules/node/templates/node.html.twig b/core/modules/node/templates/node.html.twig index c7ada1e54f6..0833ae40680 100644 --- a/core/modules/node/templates/node.html.twig +++ b/core/modules/node/templates/node.html.twig @@ -15,7 +15,7 @@ * 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. + * - label: (optional) 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 @@ -23,8 +23,8 @@ * - 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. + * - date: (optional) Themed creation date field. + * - author_name: (optional) 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. @@ -75,7 +75,7 @@ {{ title_prefix }} - {% if not page %} + {% if label and not page %} {{ label }} diff --git a/core/modules/node/tests/modules/node_display_configurable_test/config/install/rdf.mapping.node.page.yml b/core/modules/node/tests/modules/node_display_configurable_test/config/install/rdf.mapping.node.page.yml new file mode 100644 index 00000000000..dd6535c3044 --- /dev/null +++ b/core/modules/node/tests/modules/node_display_configurable_test/config/install/rdf.mapping.node.page.yml @@ -0,0 +1,40 @@ +langcode: en +status: true +dependencies: + config: + - node.type.page + module: + - node +id: node.page +targetEntityType: node +bundle: page +types: + - 'schema:WebPage' +fieldMappings: + title: + properties: + - 'schema:name' + created: + properties: + - 'schema:dateCreated' + datatype_callback: + callable: 'Drupal\rdf\CommonDataConverter::dateIso8601Value' + changed: + properties: + - 'schema:dateModified' + datatype_callback: + callable: 'Drupal\rdf\CommonDataConverter::dateIso8601Value' + body: + properties: + - 'schema:text' + uid: + properties: + - 'schema:author' + mapping_type: rel + comment_count: + properties: + - 'schema:interactionCount' + datatype_callback: + callable: 'Drupal\rdf\SchemaOrgDataConverter::interactionCount' + arguments: + interaction_type: UserComments diff --git a/core/modules/node/tests/modules/node_display_configurable_test/node_display_configurable_test.info.yml b/core/modules/node/tests/modules/node_display_configurable_test/node_display_configurable_test.info.yml new file mode 100644 index 00000000000..c6b478d2713 --- /dev/null +++ b/core/modules/node/tests/modules/node_display_configurable_test/node_display_configurable_test.info.yml @@ -0,0 +1,6 @@ +name: 'Node configurable display module tests' +type: module +description: 'Support module for node \Drupal\Core\Field\BaseFieldDefinition::setDisplayConfigurable() testing.' +package: Testing +version: VERSION +core: 8.x diff --git a/core/modules/node/tests/modules/node_display_configurable_test/node_display_configurable_test.module b/core/modules/node/tests/modules/node_display_configurable_test/node_display_configurable_test.module new file mode 100644 index 00000000000..a06318dbeb8 --- /dev/null +++ b/core/modules/node/tests/modules/node_display_configurable_test/node_display_configurable_test.module @@ -0,0 +1,28 @@ +id() == 'node') { + foreach (['created', 'uid', 'title'] as $field) { + /** @var \Drupal\Core\Field\BaseFieldDefinition[] $base_field_definitions */ + $base_field_definitions[$field]->setDisplayConfigurable('view', TRUE); + } + } +} + +/** + * Implements hook_entity_type_build(). + */ +function node_display_configurable_test_entity_type_build(array &$entity_types) { + // Allow skipping of extra preprocessing for configurable display. + $entity_types['node']->set('enable_base_field_custom_preprocess_skipping', TRUE); +} diff --git a/core/modules/node/tests/src/Functional/NodeDisplayConfigurableTest.php b/core/modules/node/tests/src/Functional/NodeDisplayConfigurableTest.php new file mode 100644 index 00000000000..5bac9abfa95 --- /dev/null +++ b/core/modules/node/tests/src/Functional/NodeDisplayConfigurableTest.php @@ -0,0 +1,73 @@ +getStorage('node_type')->load('page'); + $node_type->setDisplaySubmitted(TRUE); + $node_type->save(); + + $user = $this->drupalCreateUser(['access in-place editing', 'administer nodes']); + $this->drupalLogin($user); + $node = $this->drupalCreateNode(['uid' => $user->id()]); + $assert = $this->assertSession(); + + // Check the node with Drupal default non-configurable display. + $this->drupalGet($node->toUrl()); + $assert->elementTextContains('css', 'span.field--name-created', \Drupal::service('date.formatter')->format($node->getCreatedTime())); + $assert->elementTextContains('css', 'span.field--name-uid[data-quickedit-field-id="node/1/uid/en/full"]', $user->getAccountName()); + $assert->elementTextContains('css', 'div.node__submitted', 'Submitted by'); + $assert->elementTextContains('css', 'span.field--name-title', $node->getTitle()); + + // Enable module to make base fields' displays configurable. + \Drupal::service('module_installer')->install(['node_display_configurable_test']); + + // Configure display. + $display = EntityViewDisplay::load('node.page.default'); + $display->setComponent('uid', + [ + 'type' => 'entity_reference_label', + 'label' => 'above', + 'settings' => ['link' => FALSE], + ]) + ->save(); + + // Recheck the node with configurable display. + $this->drupalGet($node->toUrl()); + $assert->elementTextContains('css', 'span.field--name-created', \Drupal::service('date.formatter')->format($node->getCreatedTime())); + $assert->elementTextContains('css', 'span.field--name-uid[data-quickedit-field-id="node/1/uid/en/full"]', $user->getAccountName()); + $assert->elementNotExists('css', 'span.field--name-uid a'); + $assert->elementTextContains('css', 'span.field--name-title', $node->getTitle()); + $assert->elementExists('css', 'span[property="schema:dateCreated"]'); + + // Remove from display. + $display->removeComponent('uid') + ->removeComponent('created') + ->save(); + + $this->drupalGet($node->toUrl()); + $assert->elementNotExists('css', '.field--name-created'); + $assert->elementNotExists('css', '.field--name-uid'); + } + +} diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module index 8c70786eac9..7570ebd5858 100644 --- a/core/modules/rdf/rdf.module +++ b/core/modules/rdf/rdf.module @@ -323,13 +323,30 @@ function rdf_preprocess_node(&$variables) { // Adds RDFa markup for the date. $created_mapping = $mapping->getPreparedFieldMapping('created'); - if (!empty($created_mapping) && $variables['display_submitted']) { + if (!empty($created_mapping)) { $date_attributes = rdf_rdfa_attributes($created_mapping, $variables['node']->get('created')->first()->toArray()); $rdf_metadata = [ '#theme' => 'rdf_metadata', '#metadata' => [$date_attributes], ]; - $variables['metadata'] = \Drupal::service('renderer')->render($rdf_metadata); + + // Depending on whether custom preprocessing is enabled, the 'created' + // field may appear in either of two different places, so check both of + // those places here. + // @see template_preprocess_node. + if (!empty($variables['display_submitted'])) { + // If custom preprocessing is enabled, then detect if the 'created' + // field is displayed by checking the 'display_submitted' variable. In + // this case, for back-compatibility, put the metadata into a special + // variable. + $variables['metadata'] = \Drupal::service('renderer')->render($rdf_metadata); + } + elseif (isset($variables['elements']['created'])) { + // Otherwise, detect if the 'created' field is displayed by checking if + // it is present in the 'elements variable. Put the metadata into + // title_suffix, along with other metadata added by this module. + $variables['title_suffix']['rdf_meta_created'] = $rdf_metadata; + } } // Adds RDFa markup annotating the number of comments a node has. diff --git a/core/profiles/demo_umami/themes/umami/templates/content/node--article--full.html.twig b/core/profiles/demo_umami/themes/umami/templates/content/node--article--full.html.twig index 70b897dc922..7cd0fe0f53c 100644 --- a/core/profiles/demo_umami/themes/umami/templates/content/node--article--full.html.twig +++ b/core/profiles/demo_umami/themes/umami/templates/content/node--article--full.html.twig @@ -15,7 +15,7 @@ * 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. + * - label: (optional) 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 @@ -23,8 +23,8 @@ * - 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. + * - date: (optional) Themed creation date field. + * - author_name: (optional) 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. @@ -81,11 +81,13 @@ {{ title_prefix }} + {% if label %}

{{ label }}

+ {% endif %} {{ title_suffix }} {% if display_submitted %} diff --git a/core/profiles/demo_umami/themes/umami/templates/content/node--card-common-alt.html.twig b/core/profiles/demo_umami/themes/umami/templates/content/node--card-common-alt.html.twig index 8aea1b79029..545205b64e1 100644 --- a/core/profiles/demo_umami/themes/umami/templates/content/node--card-common-alt.html.twig +++ b/core/profiles/demo_umami/themes/umami/templates/content/node--card-common-alt.html.twig @@ -15,7 +15,7 @@ * 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. + * - label: (optional) 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 @@ -23,8 +23,8 @@ * - 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. + * - date: (optional) Themed creation date field. + * - author_name: (optional) 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. diff --git a/core/profiles/demo_umami/themes/umami/templates/content/node--card-common.html.twig b/core/profiles/demo_umami/themes/umami/templates/content/node--card-common.html.twig index f1b6a547cbb..e326e37f4f5 100644 --- a/core/profiles/demo_umami/themes/umami/templates/content/node--card-common.html.twig +++ b/core/profiles/demo_umami/themes/umami/templates/content/node--card-common.html.twig @@ -15,7 +15,7 @@ * 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. + * - label: (optional) 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 @@ -23,8 +23,8 @@ * - 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. + * - date: (optional) Themed creation date field. + * - author_name: (optional) 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. @@ -86,7 +86,7 @@ {{ title_prefix }} - {% if not page %} + {% if label and not page %} {{ label }} diff --git a/core/profiles/demo_umami/themes/umami/templates/content/node--card.html.twig b/core/profiles/demo_umami/themes/umami/templates/content/node--card.html.twig index 4737ca221e3..e4d0289aeca 100644 --- a/core/profiles/demo_umami/themes/umami/templates/content/node--card.html.twig +++ b/core/profiles/demo_umami/themes/umami/templates/content/node--card.html.twig @@ -15,7 +15,7 @@ * 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. + * - label: (optional) 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 @@ -23,8 +23,8 @@ * - 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. + * - date: (optional) Themed creation date field. + * - author_name: (optional) 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. @@ -83,7 +83,7 @@ {{ title_prefix }} - {% if not page %} + {% if label and not page %} {{ label }} diff --git a/core/profiles/demo_umami/themes/umami/templates/content/node--recipe--full.html.twig b/core/profiles/demo_umami/themes/umami/templates/content/node--recipe--full.html.twig index 96ad360ae09..67ec67cf2a8 100644 --- a/core/profiles/demo_umami/themes/umami/templates/content/node--recipe--full.html.twig +++ b/core/profiles/demo_umami/themes/umami/templates/content/node--recipe--full.html.twig @@ -15,7 +15,7 @@ * 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. + * - label: (optional) 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 @@ -23,8 +23,8 @@ * - 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. + * - date: (optional) Themed creation date field. + * - author_name: (optional) 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. @@ -81,11 +81,13 @@ view_mode ? 'node--view-mode-' ~ view_mode|clean_class, {{ title_prefix }} + {% if label %}

{{ label }}

+ {% endif %} {{ title_suffix }} {% if display_submitted %} diff --git a/core/profiles/demo_umami/themes/umami/templates/content/node.html.twig b/core/profiles/demo_umami/themes/umami/templates/content/node.html.twig index 69c384b9fa9..359f926dd1f 100644 --- a/core/profiles/demo_umami/themes/umami/templates/content/node.html.twig +++ b/core/profiles/demo_umami/themes/umami/templates/content/node.html.twig @@ -15,7 +15,7 @@ * 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. + * - label: (optional) 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 @@ -23,8 +23,8 @@ * - 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. + * - date: (optional) Themed creation date field. + * - author_name: (optional) 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. @@ -82,16 +82,18 @@ {{ title_prefix }} - {% if page %} -
-

- {{ label }} -

-
- {% else %} - - {{ label }} - + {% if label %} + {% if page %} +
+

+ {{ label }} +

+
+ {% else %} + + {{ label }} + + {% endif %} {% endif %} {{ title_suffix }} diff --git a/core/themes/bartik/templates/node.html.twig b/core/themes/bartik/templates/node.html.twig index b257ad3cb66..c7495223fed 100644 --- a/core/themes/bartik/templates/node.html.twig +++ b/core/themes/bartik/templates/node.html.twig @@ -15,7 +15,7 @@ * 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. + * - label: (optional) 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 @@ -23,8 +23,8 @@ * - 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. + * - date: (optional) Themed creation date field. + * - author_name: (optional) 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. @@ -81,7 +81,7 @@
{{ title_prefix }} - {% if not page %} + {% if label and not page %} {{ label }} diff --git a/core/themes/classy/templates/content/node.html.twig b/core/themes/classy/templates/content/node.html.twig index 7f99e796f62..a42ff52d025 100644 --- a/core/themes/classy/templates/content/node.html.twig +++ b/core/themes/classy/templates/content/node.html.twig @@ -15,7 +15,7 @@ * 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. + * - label: (optional) 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 @@ -23,8 +23,8 @@ * - 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. + * - date: (optional) Themed creation date field. + * - author_name: (optional) 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. @@ -84,7 +84,7 @@ {{ title_prefix }} - {% if not page %} + {% if label and not page %} {{ label }}