- Issue created by @catch
- 🇬🇧United Kingdom longwave UK
Controllers return output that is wrapped into the main content block in page.html.twig.
page_top
is for things that get printed outside of the normal page wrapper, but maybe the main content block could bubble this up to the top level somehow? - 🇬🇧United Kingdom longwave UK
I thought about this some more; we already allow
['#attached']['html_head']
to add things to<head>
, so why not allow['#attached']['page_top']
to put things in the page top? - Status changed to Postponed: needs info
about 1 month ago 12:32am 24 March 2025 - 🇦🇺Australia acbramley
This is a fairly common pattern in core, contrib and custom code. We have 6 implementations in core (block, navigation, node, system, update, toolbar) that all do some variation of checking route, request, or user permissions to add stuff to the page.
Is this really that much of an overhead or something that shouldn't be done?
- 🇬🇧United Kingdom catch
Navigation and toolbar both add their markup on every page, for me that's a good use of the hook.
System and update add it for all admin users on all admin pages, that's again close to 'site-wide' and seems OK, although to a large extent it's compensation for not having dashboard module or similar in core.
Block's implementation is very similar to node's - it's adding some specific markup for a specific route, for me that should also be done in the route controller one way or another. Feels like a symptom of both block and node preview being very ancient. Moving back to active but yes it's not the worst thing in the world so downgrading to minor.