Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The overlay can be made reusable very simply by skipping its own initialization if some other module already did the overlay setup. This can be used to disable / enable the overlay in creative way without intervening with overlay's own code.
A very simple change makes this possible. Just check in overlay_init() whether we have an overlay mode set already. If we do, then we can just skip our own initialization.
Comment | File | Size | Author |
---|---|---|---|
#8 | overlay-init.patch | 3.39 KB | casey |
#1 | overlay-check-mode-743908-1.patch | 3.54 KB | David_Rothstein |
overlay-check-mode.patch | 1.16 KB | Gábor Hojtsy | |
Comments
Comment #1
David_Rothstein CreditAttribution: David_Rothstein commentedThis makes sense, although some of that is there already, right? (Since overlay_set_mode() already only works the first time you call it...) But I guess this patch would also prevent some of the stuff that's hardcoded into overlay_init() from running as well. It's not totally clear to me what the boundary is between code that belongs inside overlay_init() and code that belongs inside overlay_set_mode() itself.
Anyway, here is an updated patch that fixes a typo in the code comment and also tries to rewrite and expand the code comments for overlay_set_mode() to explain more how other modules can actually enable/disable the overlay. I think it might still need a bit more work, though.
Comment #2
Gábor HojtsyNew patch is the same approach that I did above but has added comments on how useful it is :) I think its great. Since it is mostly a docs/typo change, I don't feel empowered to RTBC it, since it feels like RTBC-ing my own patch :)
Comment #3
ksenzeeLooks great to me. Probably overlay_init() and overlay_set_mode() could largely be combined, but that's an issue for another day.
Comment #4
klausitrailing whitespace
Powered by Dreditor.
Comment #5
aspilicious CreditAttribution: aspilicious commented#1: overlay-check-mode-743908-1.patch queued for re-testing.
Comment #6
aspilicious CreditAttribution: aspilicious commentedThink this needs a reroll
Comment #8
casey CreditAttribution: casey commentedReroll.
Comment #9
ksenzeeThanks for the reroll casey. Still looks good and tests fine.
Comment #10
Dries CreditAttribution: Dries commentedLooks good, and thanks for the extra information. Committed to CVS HEAD. Thanks.