Follow up from #765860-18: drupal_alter() fails to order modules correctly in some cases. Although a feature request, I'm hoping it's accepted for D7, because it's cool, and I don't see any down side. Although hook_page_alter() is being used by core modules (which is neat) and will likely be used by contrib modules (which is also neat), I think its biggest awesomeness is what it will enable site builders to accomplish in site-specific modules and themes. And for these, I think the extra targeted hooks will be very useful.
One could claim that something similar could be useful with hook_(node|comment|user|*)_view_alter(), but that needs to be explored in a separate issue, because performance implications need to be evaluated (drupal_alter() static caching incurs more cache misses when passing additional targets). But the hook_page_alter() sequence runs just once per page request, so it's a cache miss anyway, and the extra calls to module_implements() are insignificant when only done once per page request, so it seems like a no-brainer.
Comment | File | Size | Author |
---|---|---|---|
hook_page_alter-advanced.patch | 1.58 KB | effulgentsia | |
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedTerriific 1 line patch. Its great that we can reuse theme_get_suggestions(). Consistency++
Comment #2
rfaysubscribe
Comment #3
webchickGuys, at exactly what point does this stop? This is about the 3rd of 4th one of these patches you've tried to sneak in post-API freeze.
Comment #4
moshe weitzman CreditAttribution: moshe weitzman commentedIMO, this low-risk sort of patch stops at about RC1 or RC2. Alpha and Beta are ripe for patches like this (improve consistency, coherency, ...).
The real problem and anxiety is that we are not making good progress anymore on the criticals queue. Thats an entirely different problem from this sort of patch. Postponing low-risk improvements during Alpha is wrong IMO. If postponing could magically transfer developer attention to the criticals queue then sure. But alas attention doesn't work like that. We've already shut down HEAD for new features for about as long as its ever been shut down.
Comment #5
webchickSee, to me this reads like one of those non-API breaking enhancements that would get committed to Drupal 8 and then back-ported to Drupal 7, which is something new we're doing this release. Of course, in order to get it committed to Drupal 8, Drupal 7 would need to first get released... ;)
Anyway, we'll see what Dries thinks.
Comment #6
Dries CreditAttribution: Dries commentedI think this needs to go in Drupal 8 first. We can consider back-porting it later on.
Comment #7
moshe weitzman CreditAttribution: moshe weitzman commentedUm, if something is eligible for d7 after it is released then why would it be ineligible during alpha? that does not compute for me.
Comment #8
effulgentsia CreditAttribution: effulgentsia commentedIf the answer is to set (or continue) a precedent of increased strictness to (at least try to) focus both committer and developer attention on the criticals, then I can see the logic in that.
Comment #9
sunLovely patch. Truly RTBC.
Comment #10
effulgentsia CreditAttribution: effulgentsia commented@sun: thx! in case you didn't notice, it got bumped to D8 (possibly to be ported to D7 after D7 is released). If you'd like it in D7 prior to D7 release, please help pitch why.
Comment #11
Lars Toomre CreditAttribution: Lars Toomre commentedBump... Can this now be applied to D8 and D7 before D7.1 release?
Comment #12
catchTagging for backport, it's only an API addition.
Comment #13
catchhook_page_alter-advanced.patch queued for re-testing.
Comment #15
sunmmm, apparently the most interesting case blows up...
9 days to next Drupal core point release.
Comment #16
dawehnerWe don't provide those global level alter hooks anylonger. yes!