function NodeRevisionsTest::renderContextualLinks
Same name in other branches
- 8.9.x core/modules/node/tests/src/Functional/NodeRevisionsTest.php \Drupal\Tests\node\Functional\NodeRevisionsTest::renderContextualLinks()
Gets server-rendered contextual links for the given contextual links IDs.
Parameters
string[] $ids: An array of contextual link IDs.
string $current_path: The Drupal path for the page for which the contextual links are rendered.
Return value
string The decoded JSON response body.
File
-
core/
modules/ node/ tests/ src/ Functional/ NodeRevisionsTest.php, line 374
Class
- NodeRevisionsTest
- Tests per-content-type node CRUD operation permissions.
Namespace
Drupal\Tests\node\FunctionalCode
protected function renderContextualLinks(array $ids, $current_path) {
$post = [];
for ($i = 0; $i < count($ids); $i++) {
$post['ids[' . $i . ']'] = $ids[$i];
}
$response = $this->drupalPost('contextual/render', 'application/json', $post, [
'query' => [
'destination' => $current_path,
],
]);
return Json::decode($response);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.