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\ControllerCode
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);
}