diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/Link.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/Link.php index 819b8dd..1090ea8 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/field/Link.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/Link.php @@ -56,11 +56,14 @@ public function render(ResultRow $values) { } } + /** + * {@inheritdoc} + */ protected function renderLink($node, ResultRow $values) { if (node_access('view', $node)) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = 'node/' . $node->id(); - $text = !empty($this->options['text']) ? $this->sanitizeValue($this->options['text']) : t('view'); + $text = !empty($this->options['text']) ? $this->sanitizeValue($this->options['text']) : t('View'); return $text; } } diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLink.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLink.php index 1941271..5bbae00 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLink.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLink.php @@ -54,7 +54,7 @@ function preRender(&$values) { * {@inheritdoc} */ protected function renderLink($data, ResultRow $values) { - list($node, $revision_node, $vid) = $this->get_revision_entity($values, 'view'); + list($node, $revision_node, $vid) = $this->getRevisionEntity($values, 'view'); if (!isset($vid)) { return; } @@ -76,14 +76,14 @@ protected function renderLink($data, ResultRow $values) { /** * Returns the revision values of a node. * - * @param \stdClass $values + * @param \Drupal\views\ResultRow $values * An object containing all retrieved values. * @param string $op * The operation being performed. * * @return array */ - function get_revision_entity(\stdClass $values, $op) { + public function getRevisionEntity(ResultRow $values, $op) { $vid = $this->getValue($values, 'vid'); $revision_node = node_revision_load($vid); $node = node_load($revision_node->id()); diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkDelete.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkDelete.php index 152241b..ab7f1f3 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkDelete.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkDelete.php @@ -24,7 +24,7 @@ class RevisionLinkDelete extends RevisionLink { * {@inheritdoc} */ protected function renderLink($data, ResultRow $values) { - list($node, $revision_node, $vid) = $this->get_revision_entity($values, 'update'); + list($node, $revision_node, $vid) = $this->getRevisionEntity($values, 'update'); $type = $node->bundle(); if (!($access = (user_access("delete $type revisions") || user_access('delete all revisions') || user_access('administer nodes')) && node_access('delete', $revision_node))) { diff --git a/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkRevert.php b/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkRevert.php index d32c743..100bb8c 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkRevert.php +++ b/core/modules/node/lib/Drupal/node/Plugin/views/field/RevisionLinkRevert.php @@ -24,7 +24,7 @@ class RevisionLinkRevert extends RevisionLink { * {@inheritdoc} */ protected function renderLink($data, ResultRow $values) { - list($node, $revision_node, $vid) = $this->get_revision_entity($values, 'update'); + list($node, $revision_node, $vid) = $this->getRevisionEntity($values, 'update'); $type = $node->bundle(); if (!($access = (user_access("revert $type revisions") || user_access('revert all revisions') || user_access('administer nodes')) && node_access('update', $node))) { diff --git a/core/modules/node/lib/Drupal/node/Tests/Views/RevisionLinkTest.php b/core/modules/node/lib/Drupal/node/Tests/Views/RevisionLinkTest.php index 6282f13..821251f 100644 --- a/core/modules/node/lib/Drupal/node/Tests/Views/RevisionLinkTest.php +++ b/core/modules/node/lib/Drupal/node/Tests/Views/RevisionLinkTest.php @@ -64,20 +64,20 @@ public function testRevisionLinks() { // access denied if you link to the revision. $uri = $this->nodes[0]->uri(); $this->assertLinkByHref($uri['path']); - $this->assertNoLinkByHref($uri['path'] . '/revisions/' . $this->revisions[0]->vid . '/delete'); - $this->assertNoLinkByHref($uri['path'] . '/revision/' . $this->revisions[0]->vid . '/revert'); + $this->assertNoLinkByHref($uri['path'] . '/revisions/' . $this->revisions[0]->vid->value . '/delete'); + $this->assertNoLinkByHref($uri['path'] . '/revision/' . $this->revisions[0]->vid->value . '/revert'); // For the second node the current revision got set to the last revision, so // the first one should also link to the node page itself. $uri = $this->revisions[1]->uri(); - $this->assertLinkByHref($uri['path'] . '/revisions/' . $this->revisions[1]->vid . '/view'); - $this->assertLinkByHref($uri['path'] . '/revisions/' . $this->revisions[1]->vid . '/delete'); - $this->assertLinkByHref($uri['path'] . '/revisions/' . $this->revisions[1]->vid . '/revert'); + $this->assertLinkByHref($uri['path'] . '/revisions/' . $this->revisions[1]->vid->value . '/view'); + $this->assertLinkByHref($uri['path'] . '/revisions/' . $this->revisions[1]->vid->value . '/delete'); + $this->assertLinkByHref($uri['path'] . '/revisions/' . $this->revisions[1]->vid->value . '/revert'); $uri = $this->revisions[2]->uri(); $this->assertLinkByHref($uri['path']); - $this->assertNoLinkByHref($uri['path'] . '/revisions/' . $this->revisions[2]->vid . '/delete'); - $this->assertNoLinkByHref($uri['path'] . '/revisions/' . $this->revisions[2]->vid . '/revert'); + $this->assertNoLinkByHref($uri['path'] . '/revisions/' . $this->revisions[2]->vid->value . '/delete'); + $this->assertNoLinkByHref($uri['path'] . '/revisions/' . $this->revisions[2]->vid->value . '/revert'); $accounts = array(); $accounts['view'] = $this->drupalCreateUser(array('view all revisions')); @@ -95,10 +95,10 @@ public function testRevisionLinks() { // Check expected links. foreach ($operations as $operation) { if ($operation == $op) { - $this->assertLinkByHref($uri['path'] . '/revisions/' . $this->revisions[1]->vid . '/' . $operation); + $this->assertLinkByHref($uri['path'] . '/revisions/' . $this->revisions[1]->vid->value . '/' . $operation); } else { - $this->assertNoLinkByHref($uri['path'] . '/revisions/' . $this->revisions[1]->vid . '/' . $operation); + $this->assertNoLinkByHref($uri['path'] . '/revisions/' . $this->revisions[1]->vid->value . '/' . $operation); } } }