protected function CookiesConfigService::getConfig in COOKiES Consent Management 1.0.x
Returns the configuration object for Cookies JSR.
Return value
array[] Configuration object.
1 call to CookiesConfigService::getConfig()
- CookiesConfigService::getCookiesConfig in src/
Services/ CookiesConfigService.php - Returns the complete formatted Cookies JSR configuration.
File
- src/
Services/ CookiesConfigService.php, line 197
Class
- CookiesConfigService
- Services to handle module config and method for a rendered documentation.
Namespace
Drupal\cookies\ServicesCode
protected function getConfig() {
$config = $this->cookiesConfig;
$expires = (int) $config
->get('cookie_expires');
$expires = $expires ?: 30;
$expires = $expires * 24 * 60 * 60 * 1000;
// @todo config 'callback_method' and 'callback_url' to be removed.
$callback = [
"method" => $config
->get('callback_method') ?? 'post',
"url" => $config
->get('callback_url') ?? Url::fromRoute('cookies.callback')
->toString(),
"headers" => [],
];
$availableLangs = [];
foreach ($this->languageManager
->getLanguages() as $key => $lang) {
$availableLangs[] = $key;
}
$defaultLang = $this->languageManager
->getDefaultLanguage()
->getId();
$libPath = $this
->getLibraryUrl();
return [
"cookie" => [
"name" => $config
->get('cookie_name'),
"expires" => $expires,
"domain" => $config
->get('cookie_domain'),
"sameSite" => $config
->get('cookie_same_site'),
"secure" => (bool) $config
->get('cookie_secure'),
],
"library" => [
"libBasePath" => $libPath,
"libPath" => $libPath . '/cookiesjsr.min.js',
"scrollLimit" => (int) $config
->get('lib_scroll_limit'),
],
"callback" => $callback,
"interface" => [
"openSettingsHash" => "#{$config->get('open_settings_hash')}",
"showDenyAll" => (bool) $config
->get('show_deny_all'),
"settingsAsLink" => (bool) $config
->get('settings_as_link'),
"availableLangs" => $availableLangs,
"defaultLang" => $defaultLang,
"groupConsent" => (bool) $config
->get('group_consent'),
"cookieDocs" => (bool) $config
->get('cookie_docs'),
],
];
}