Skip to content
Snippets Groups Projects
Commit 68d31161 authored by paranojik's avatar paranojik Committed by Daniel Wehner
Browse files

Issue #2717937 by paranojik: RevisionControllerTrait doesn't properly display operation links

parent 70a105ae
No related branches found
No related tags found
No related merge requests found
......@@ -155,7 +155,13 @@ trait RevisionControllerTrait {
}
}
else {
$row[] = $this->getOperationLinks($revision);
$links = $this->getOperationLinks($revision);
$row[] = [
'data' => [
'#type' => 'operations',
'#links' => $links,
],
];
}
}
......
......@@ -72,10 +72,10 @@ class RevisionOverviewController extends ControllerBase {
* {@inheritdoc}
*/
protected function buildRevertRevisionLink(EntityInterface $entity_revision) {
if ($entity_revision->hasLinkTemplate('revision-revert')) {
if ($entity_revision->hasLinkTemplate('revision-revert-form')) {
return [
'title' => t('Revert'),
'url' => $entity_revision->toUrl('revision-revert'),
'url' => $entity_revision->toUrl('revision-revert-form'),
];
}
}
......@@ -84,10 +84,10 @@ class RevisionOverviewController extends ControllerBase {
* {@inheritdoc}
*/
protected function buildDeleteRevisionLink(EntityInterface $entity_revision) {
if ($entity_revision->hasLinkTemplate('revision-delete')) {
if ($entity_revision->hasLinkTemplate('revision-delete-form')) {
return [
'title' => t('Delete'),
'url' => $entity_revision->toUrl('revision-delete'),
'url' => $entity_revision->toUrl('revision-delete-form'),
];
}
}
......
......@@ -84,6 +84,20 @@ class RevisionBasicUITest extends KernelTestBase {
// This ensures that the default revision is still the first revision.
$this->assertTrue(strpos($response->getContent(), 'entity_test_enhanced/1/revisions/2/view') !== FALSE);
$this->assertTrue(strpos($response->getContent(), 'entity_test_enhanced/1') !== FALSE);
// Publish a new revision.
$revision = clone $entity;
$revision->name->value = 'rev 3';
$revision->setNewRevision(TRUE);
$revision->isDefaultRevision(TRUE);
$revision->save();
$request = Request::create($revision->url('version-history'));
$response = $http_kernel->handle($request);
$this->assertEquals(200, $response->getStatusCode());
// The first revision row should now include a revert link.
$this->assertTrue(strpos($response->getContent(), 'entity_test_enhanced/1/revisions/1/revert') !== FALSE);
}
public function testRevisionView() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment