Our page and region templates need to access fields from the custom blocks inside that region.
Unfortunately, {{ region.block_id.field_x }}
doesn't work, because region.block_id
only contains a #lazy_builder
, and therefore the actual variables inside that render array aren't available until we're in the block template itself (at which point it's not possible to inject variables back into the parent template).
Basically, it looks like what we need is a theme_preprocess(&$variables)
that iterates over all child elements and recursively evaluates their lazy builders / pre-render hooks, so that all nested elements are available to parent templates. Is there an easy way to do this, or are we stuck with re-implementing parts of the render API here?