diff --git a/core/modules/node/src/NodeViewBuilder.php b/core/modules/node/src/NodeViewBuilder.php index d7138db..c65250e 100644 --- a/core/modules/node/src/NodeViewBuilder.php +++ b/core/modules/node/src/NodeViewBuilder.php @@ -148,7 +148,7 @@ protected function alterBuild(array &$build, EntityInterface $entity, EntityView if ($entity->id()) { if ($entity->isDefaultRevision()) { $build['#contextual_links']['node'] = [ - 'route_parameters' => array('node' => $entity->id()), + 'route_parameters' => ['node' => $entity->id()], 'metadata' => ['changed' => $entity->getChangedTime()], ]; } diff --git a/core/modules/node/src/Tests/NodeRevisionsTest.php b/core/modules/node/src/Tests/NodeRevisionsTest.php index 725a085..c1d37d7 100644 --- a/core/modules/node/src/Tests/NodeRevisionsTest.php +++ b/core/modules/node/src/Tests/NodeRevisionsTest.php @@ -162,8 +162,8 @@ function testRevisions() { // Confirm that the "Edit" and "Delete" contextual links appear for the // default revision. - $ids = array('node:node=' . $node->id() . ':changed=' . $node->getChangedTime()); - $json = $this->renderContextualLinks($ids, "node/" . $node->id()); + $ids = ['node:node=' . $node->id() . ':changed=' . $node->getChangedTime()]; + $json = $this->renderContextualLinks($ids, 'node/' . $node->id()); $this->verbose($json[$ids[0]]); $expected = '
  • Edit
  • '; @@ -187,8 +187,8 @@ function testRevisions() { // Confirm that "Edit" and "Delete" contextual links don't appear for // non-default revision. - $ids = array('node_revision::node=' . $node->id() . '&node_revision=' . $node->getRevisionId() . ':'); - $json = $this->renderContextualLinks($ids, "node/" . $node->id() . '/revisions/' . $node->getRevisionId() . '/view'); + $ids = ['node_revision::node=' . $node->id() . '&node_revision=' . $node->getRevisionId() . ':']; + $json = $this->renderContextualLinks($ids, 'node/' . $node->id() . '/revisions/' . $node->getRevisionId() . '/view'); $this->verbose($json[$ids[0]]); $this->assertFalse(strstr($json[$ids[0]], '
  • '), 'The "Edit" contextual link is not shown for a non-default revision.'); @@ -346,8 +346,9 @@ function testNodeRevisionWithoutLogMessage() { $node_revision = $node_storage->load($node->id()); $this->assertTrue(empty($node_revision->revision_log->value), 'After a new node revision is saved with an empty log message, the log message for the node is empty.'); } + /** - * Get server-rendered contextual links for the given contextual links ids. + * Gets server-rendered contextual links for the given contextual links IDs. * * @param string[] $ids * An array of contextual link IDs. @@ -357,7 +358,7 @@ function testNodeRevisionWithoutLogMessage() { * @return string * The decoded JSON response body. */ - protected function renderContextualLinks($ids, $current_path) { + protected function renderContextualLinks(array $ids, $current_path) { $post = array(); for ($i = 0; $i < count($ids); $i++) { $post['ids[' . $i . ']'] = $ids[$i];