Closed andybroomfield closed 1 year ago
So an alternative is to use loadEntitiesForTreeNodesWithoutAccessChecks
just to look for the parent subsite ID, which is needed to add a cache context.
I assume that as the navigation block, there is no real risk in leaking the subsite entity to the template if the overview entity is fetched for cache purposes?
@andybroomfield It's definitely a caching issue, but I have only managed to solve it by adding a drupal_flush_all_caches();
before getting the subsite_page1 contents.
I think this is fine so will push the change.
Fix #118
Set the $subsite_id and $overview_entity to NULL if the overview is unpublished and the user doesn't have access to it. (It's not found in loadAndAccessCheckEntitysForTreeNodes).
This also required a change in the subsite navigation twig to check that the link has a url before attempting to output it, a simmilar change will be needed on any theme that has implemented the template.
Note: The test fails here due to the way the blocks cache.