function VersionHistoryController::revisionOverview
Same name in other branches
- 10 core/lib/Drupal/Core/Entity/Controller/VersionHistoryController.php \Drupal\Core\Entity\Controller\VersionHistoryController::revisionOverview()
Generates an overview table of revisions of an entity.
Parameters
\Drupal\Core\Entity\RevisionableInterface $entity: A revisionable entity.
Return value
array A render array.
1 call to VersionHistoryController::revisionOverview()
- VersionHistoryController::__invoke in core/
lib/ Drupal/ Core/ Entity/ Controller/ VersionHistoryController.php - Generates an overview table of revisions for an entity.
File
-
core/
lib/ Drupal/ Core/ Entity/ Controller/ VersionHistoryController.php, line 242
Class
- VersionHistoryController
- Provides a controller showing revision history for an entity.
Namespace
Drupal\Core\Entity\ControllerCode
protected function revisionOverview(RevisionableInterface $entity) : array {
$build['entity_revisions_table'] = [
'#theme' => 'table',
'#header' => [
'revision' => [
'data' => $this->t('Revision'),
],
'operations' => [
'data' => $this->t('Operations'),
],
],
];
foreach ($this->loadRevisions($entity) as $revision) {
$build['entity_revisions_table']['#rows'][$revision->getRevisionId()] = $this->buildRow($revision);
}
$build['pager'] = [
'#type' => 'pager',
];
(new CacheableMetadata())->addCacheableDependency($entity)
->addCacheContexts([
'languages:language_content',
])
->applyTo($build);
return $build;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.