Skip to content
Snippets Groups Projects
Commit d81dd8ca authored by Sven Berg Ryen's avatar Sven Berg Ryen
Browse files

Issue #3238918 by svenryen, Ahmed_Samir: ServiceNotFoundException: You have...

Issue #3238918 by svenryen, Ahmed_Samir: ServiceNotFoundException: You have requested a non-existent service "cache.page" | revert page cache module dependency
parent b3ce78e4
No related branches found
Tags 8.x-1.16
No related merge requests found
......@@ -113,13 +113,19 @@ class EuCookieComplianceConfigForm extends ConfigFormBase {
$this->filterFormatStorage = $entity_type_manager;
$this->consentStorage = $consent_storage;
$this->cacheBootstrap = $cache_bootstrap;
$this->cachePage = $cache_page;
if ($cache_page->get('bin') === 'cache_page') {
$this->cachePage = $cache_page;
}
else {
$this->cachePage = NULL;
}
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
$module_handler = $container->get('module_handler');
return new static(
$container->get('config.factory'),
$container->get('path.validator'),
......@@ -129,7 +135,9 @@ class EuCookieComplianceConfigForm extends ConfigFormBase {
$container->get('entity_type.manager'),
$container->get('plugin.manager.eu_cookie_compliance.consent_storage'),
$container->get('cache.bootstrap'),
$container->get('cache.page')
// Use a cache that's available to the user if the page cache isn't
// available.
$module_handler->moduleExists('cache.page') ? $container->get('cache.page') : $container->get('cache.render')
);
}
......@@ -1119,7 +1127,9 @@ class EuCookieComplianceConfigForm extends ConfigFormBase {
// It's sufficient to clear bootstrap and page cache.
if ($form_state->getValue('eu_only_js')) {
$this->cacheBootstrap->invalidateAll();
$this->cachePage->invalidateAll();
if ($this->cachePage !== NULL) {
$this->cachePage->invalidateAll();
}
}
// If there's no mobile message entered, disable the feature.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment