function ContextualDynamicContextTest::renderContextualLinks
Same name in other branches
- 9 core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php \Drupal\Tests\contextual\Functional\ContextualDynamicContextTest::renderContextualLinks()
- 8.9.x core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php \Drupal\Tests\contextual\Functional\ContextualDynamicContextTest::renderContextualLinks()
- 11.x core/modules/contextual/tests/src/Functional/ContextualDynamicContextTest.php \Drupal\Tests\contextual\Functional\ContextualDynamicContextTest::renderContextualLinks()
Get server-rendered contextual links for the given contextual link ids.
Parameters
array $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
\Psr\Http\Message\ResponseInterface The response object.
1 call to ContextualDynamicContextTest::renderContextualLinks()
- ContextualDynamicContextTest::testDifferentPermissions in core/
modules/ contextual/ tests/ src/ Functional/ ContextualDynamicContextTest.php - Tests contextual links with different permissions.
File
-
core/
modules/ contextual/ tests/ src/ Functional/ ContextualDynamicContextTest.php, line 267
Class
- ContextualDynamicContextTest
- Tests contextual link display on the front page based on permissions.
Namespace
Drupal\Tests\contextual\FunctionalCode
protected function renderContextualLinks($ids, $current_path) {
$tokens = array_map([
$this,
'createContextualIdToken',
], $ids);
$http_client = $this->getHttpClient();
$url = Url::fromRoute('contextual.render', [], [
'query' => [
'_format' => 'json',
'destination' => $current_path,
],
]);
return $http_client->request('POST', $this->buildUrl($url), [
'cookies' => $this->getSessionCookies(),
'form_params' => [
'ids' => $ids,
'tokens' => $tokens,
],
'http_errors' => FALSE,
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.