Automatically closed - issue fixed for 2 weeks with no activity.
- ๐บ๐ธUnited States smustgrave
So tested this by kinda following the CR (which updated the version numbers)
Copied
$variables['render_array'] = [
'#prefix' => '',
];Into olivero_preprocess_page_title and placed
{% trans %}
This is a {{ render_array }}.
{% endtrans %}In the page_title.html.twig file.
Got a fatal error
Applied the MR
Now the error is gone and "This is a trans render array" appears just fine.
@catch Thanks for those issue links. And yeah, my question is not a blocker here.
One thing about this issue, though, is that maybe there should be at least 1 if not 2 tests?
- A test that any block with a plugin implementing CacheOptionalInterface is not render cached
- A test that a page with the language switcher block on it will be cached in the dynamic page cache
The first one at least since an API change is being made to BlockViewBuilder.
- ๐ฌ๐งUnited Kingdom catch
@godotislate #107 is exactly right, however there's an existing layout builder issue to address this, see ๐ Not possible to use render placeholdering with Layout Builder blocks Needs work . I've also opened an equivalent issue for experience builder here more recently: ๐ Placeholders/#lazy_builder is not supported for block component rendering Active - so for me these are bugs in those modules not fully supporting the block plugin API.
1 small nit on MR11571.
And this is a question to make sure I understand the render system correctly, not really a concern:
The language switcher block is not cached on its own, but it is placeholdered with the appropriate cache metadata. Assuming the block is placed globally within a region, because of the placeholdering, the cache contexts do not bubble to dynamic page cache entry, and the cached markup in the dynamic page cache includes the non-replaced placeholder markup.
But if the language switcher blocked were placed in a node layout via layout builder, or rendered inside another block template with
twig_tweak
or similar, then the node or wrapping block could be rendered cached with all the variations for query strings, etc.? The difference being that in HEAD, with max-age 0 being bubbled, the node or wrapping block would not be cached.