- ๐ช๐ธSpain pcambra Asturies
Just an aside comment, this patch wasn't working for me OOTB, and what I had to do is in a custom block extending the
LanguageBlock
one.Rather than using the render block, use the
getCacheContexts
method:/** * {@inheritdoc} */ public function getCacheContexts() { return Cache::mergeContexts(parent::getCacheContexts(), [ 'user.permissions', 'url.path', 'url.query_args', 'languages:language_content', 'languages:language_interface', ]); }
And rather than removing the
getCacheMaxAge
method, override it by:/** * {@inheritdoc} */ public function getCacheMaxAge() { return $this->cacheMaxAge; }
You need to include
use CacheableDependencyTrait;
in your custom block. - last update
over 1 year ago Composer error. Unable to continue. - last update
over 1 year ago 30,335 pass, 1 fail - Status changed to Active
2 months ago 10:49am 8 October 2024 - ๐ณ๐ฑNetherlands bbrala Netherlands
This is blocked on ๐ฑ Optimize render caching Needs work curretnly. But im not sure thats needed. Perhaps we can find another solution that allows us to fix this issue. That would unblock #2352009: [pp-3] Bubbling of elements' max-age to the page's headers and the page cache โ more, and i feel like the whole render cache issue is a bit to big and complicated.
- ๐ฎ๐ณIndia samit.310@gmail.com
samit.310@gmail.com โ made their first commit to this issueโs fork.
- Merge request !97982232375: Make language switcher block cacheable โ (Open) created by samit.310@gmail.com