protected function CookiesConfigService::getTranslation in COOKiES Consent Management 1.0.x
Get UI translation.
Parameters
\Drupal\Core\Language\LanguageInterface $language: The language the translation is to deliver.
Return value
array|mixed Complete translation of the config cookies.texts.
1 call to CookiesConfigService::getTranslation()
- CookiesConfigService::getCookiesConfig in src/
Services/ CookiesConfigService.php - Returns the complete formatted Cookies JSR configuration.
File
- src/
Services/ CookiesConfigService.php, line 378
Class
- CookiesConfigService
- Services to handle module config and method for a rendered documentation.
Namespace
Drupal\cookies\ServicesCode
protected function getTranslation(LanguageInterface $language) {
$config = $this->configFactory
->get('cookies.texts')
->get();
$uris = [
'privacyUri',
'imprintUri',
'cookieDocsUri',
];
foreach ($uris as $uri) {
if (preg_match('/\\/node\\/([0-9]*)$/', $config[$uri], $matches)) {
$url = Url::fromRoute('entity.node.canonical', [
'node' => $matches[1],
], [
'language' => $language,
]);
$config[$uri] = $url
->toString(TRUE)
->getGeneratedUrl();
}
}
return $config;
}