protected function ContextualDynamicContextTest::renderContextualLinks in Drupal 9
Same name and namespace in other branches
- 8 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 256
Class
- ContextualDynamicContextTest
- Tests if contextual links are showing on the front page depending 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,
]);
}