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: