Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. EntityRevisionViewController.php

function EntityRevisionViewController::title

Provides a title callback for a revision of an entity.

Parameters

\Drupal\Core\Entity\RevisionableInterface $_entity_revision: The revisionable entity, passed in directly from request attributes.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup The title for the entity revision view page.

File

core/lib/Drupal/Core/Entity/Controller/EntityRevisionViewController.php, line 91

Class

EntityRevisionViewController
Defines a controller to view an entity revision.

Namespace

Drupal\Core\Entity\Controller

Code

public function title(RevisionableInterface $_entity_revision) : TranslatableMarkup {
    $revision = $this->entityRepository
        ->getTranslationFromContext($_entity_revision);
    $titleArgs = [
        '%title' => $revision->label(),
    ];
    if (!$revision instanceof RevisionLogInterface) {
        return $this->t('Revision of %title', $titleArgs);
    }
    $titleArgs['%date'] = $this->dateFormatter
        ->format($revision->getRevisionCreationTime());
    return $this->t('Revision of %title from %date', $titleArgs);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal