private function PageContextTest::toRenderArray in Acquia Lift Connector 8.3
Same name and namespace in other branches
- 8.4 tests/src/Unit/Service/Context/PageContextTest.php \Drupal\Tests\acquia_lift\Unit\Service\Context\PageContextTest::toRenderArray()
To render array.
Parameters
array $pageContextConfig: The page context config
string $assetsUrl: The assets URL
Return value
array The render array
5 calls to PageContextTest::toRenderArray()
- PageContextTest::testPopulateHtmlHeadCredentialConfiguration in tests/
src/ Unit/ Service/ Context/ PageContextTest.php - Tests the populate() method, populateHtmlHead() sub method, credential configuration.
- PageContextTest::testPopulateHtmlHeadWithNode in tests/
src/ Unit/ Service/ Context/ PageContextTest.php - Tests the populate method, populateHtmlHead() sub method, with a Node.
- PageContextTest::testPopulateHtmlHeadWithNodeAndArrayTitle in tests/
src/ Unit/ Service/ Context/ PageContextTest.php - Tests the populate() method, populateHtmlHead() sub method, with a Node and array title.
- PageContextTest::testPopulateHtmlHeadWithNodeAndFields in tests/
src/ Unit/ Service/ Context/ PageContextTest.php - Tests the populate() method, populateHtmlHead() sub method, with a Node and fields.
- PageContextTest::testPopulateHtmlHeadWithNodeAndSimpleTitle in tests/
src/ Unit/ Service/ Context/ PageContextTest.php - Tests the populate() method, populateHtmlHead() sub method, with a Node and simple title.
File
- tests/
src/ Unit/ Service/ Context/ PageContextTest.php, line 577
Class
- PageContextTest
- PageContextTest Test.
Namespace
Drupal\Tests\acquia_lift\Unit\Service\ContextCode
private function toRenderArray($pageContextConfig, $assetsUrl) {
$renderArray = [];
foreach ($pageContextConfig as $name => $content) {
$renderArray[] = [
[
'#type' => 'html_tag',
'#tag' => 'meta',
'#attributes' => [
'itemprop' => 'acquia_lift:' . $name,
'content' => $content,
],
],
$name,
];
}
$renderArray[] = [
[
'#tag' => 'script',
'#attributes' => [
'src' => $assetsUrl . '/lift.js',
'async' => true,
],
],
'acquia_lift_javascript',
];
return $renderArray;
}