Update title for generic revision history UI

Created on 8 March 2023, over 1 year ago
Updated 9 March 2023, over 1 year ago

Problem/Motivation

The revision history route title is hardcoded as 'Revisions'

It would be better to change to 'Revisions for {entity label}' which is the format in the diff module and NodeController.

Proposed resolution

1, Add new title method in EntityController.
2, Add the above method in title_callback for getVersionHistoryRoute.

Feature request
Status

Active

Version

10.1

Component
Entity 

Last updated about 1 hour ago

Created by

🇦🇺Australia enyug

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

Comments & Activities

  • Issue created by @enyug
  • 🇦🇺Australia dpi Perth, Australia

    Why can't the Diff make this change?

    This page has traditionally been called Revisions, when viewed with a proper breadcrumb, you should already see the entity title. There shouldnt be a need for duplication. Otherwise you're going to have breadcrumb + title blocks look like:

    Home > Content > My FooBar Node

    Revisions for My FooBar Node

    Or on revision view pages:

    Home > Content > My FooBar Node > Revisions for My FooBar Node

    Revision of My Foobar Node from Tue, 10/30/2023 - 15:19
  • 🇦🇺Australia enyug
    
    public function revisionOverview(NodeInterface $node) {
        $langcode = $node
          ->language()
          ->getId();
        $langname = $node
          ->language()
          ->getName();
        $languages = $node
          ->getTranslationLanguages();
        $has_translations = count($languages) > 1;
        $node_storage = $this
          ->entityTypeManager()
          ->getStorage('node');
        $build['#title'] = $has_translations ? $this
          ->t('@langname revisions for %title', [
          '@langname' => $langname,
          '%title' => $node
            ->label(),
        ]) : $this
          ->t('Revisions for %title', [
          '%title' => $node
            ->label(),
        ]);

    I assume it should be consistence with what implemented in NodeController

  • 🇦🇺Australia dpi Perth, Australia

    Many parts of the node implementation were intentionally not brought over. The intention was not to fully replicate it out of the gate.

    We can re-evaluate whether this should be brought over in this issue.

    Based on #2 I'd prefer to not see duplicate information in breadcrumb + title.

    consistence with what implemented in NodeController

    Since as you mentioned this is also in Node, the issue summary should be updated to reflect the desire to copy whats in Node, rather than a contrib (diff).

Production build 0.71.5 2024