Node revision view page title no longer displays custom title with date

Created on 23 June 2020, almost 4 years ago
Updated 16 January 2023, over 1 year ago

Problem/Motivation

Discovered this as a part of reviewing #2730631-107: Upcast node and node_revision parameters of node revision routes β†’ , where use of a removed function did not expose lack of coverage.

\Drupal\node\Controller\NodeController::revisionPageTitle is no longer called or has test coverage.

Currently, when a node revision is rendered by entity.node.revision route, the label of the revision is output. However a title callback (\Drupal\node\Controller\NodeController::revisionPageTitle) exists to change the page title to Revision of %title from %date.

Cause

Since #2498849: Entity view controller title rendering is expensive β†’ was committed, a pre-render callback was to compute the title for entities being rendered. Once the callback (\Drupal\Core\Entity\Controller\EntityViewController::buildTitle) runs, a #title key is added to the render array. Because the key exists, the title callback for entity.node.revision is no longer executed by $get_title anonymous function in \Drupal\Core\Render\MainContent\HtmlRenderer::prepare.

Steps to reproduce

- go to /node/add/article and create a article
- edit this article
- check the revision created, if it's your first article (fresh installation) you can check it in /node/1/revisions/1/view

Proposed resolution

Add $node_revision->setTitle($this->revisionPageTitle($node_revision)); in ../core/modules/node/src/Controller/NodeController::revisionShow.

Remaining tasks

Code review

User interface changes

Existing UI:

Proposed UI:

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
Node systemΒ  β†’

Last updated about 12 hours ago

No maintainer
Created by

πŸ‡¦πŸ‡ΊAustralia dpi Perth, Australia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Needs work over 1 year ago
Production build 0.69.0 2024