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.
Because panelizer uses the admin theme for node/*/*/panelizer -- when adding a panelizer issue to the queue on drupal.org, it shows the admin theme.
How to reproduce?
* Create a panelizer issue
Not exactly sure how to fix this yet. Appears to be an issue with how drupal.org's project module works. I'm gonna guess that any other module project that appends its admin UI to a node would see a similar issue if it defines an admin theme.
Comment | File | Size | Author |
---|---|---|---|
#28 | panelizer-n2627618-28.patch | 4.33 KB | DamienMcKenna |
| |||
#23 | panelizer-n2627618-22.patch | 714 bytes | DamienMcKenna |
| |||
#20 | panelizer-n2627618-18.patch | 2.38 KB | DamienMcKenna |
| |||
#20 | panelizer-n2627618-18.interdiff.txt | 779 bytes | DamienMcKenna |
#10 | panelizer-n2627618-10.patch | 801 bytes | DamienMcKenna |
Comments
Comment #2
neclimdulhttps://www.drupal.org/node/add/project-issue/panelizer #sadtrombone
Comment #3
japerryI believe this isn't a panelizer issue. Project module shouldn't be adding additional url paths, because modules assume node/*/*/(project) is for node/edit/534534/(project)
Comment #4
japerryComment #5
DamienMcKennaThere must be a permission thing here, the problem doesn't happen for me.
Comment #6
drummYep, view/access admin theme is a separate permission.
I'm not aware of a precedent for additional things being added to the node/add path as being particularly good or bad.
If we do change this to a query parameter, redirects must also be added.
Comment #7
DamienMcKennaPanelizer matches the following path for the admin path:
.. where $path is the entity path with all arguments converted to stars, therefore it would be node/*/panelizer* and not node/*/*/panelizer as suggested. Would that still trigger the match?
Comment #8
drummnode/*/panelizer*
is indeed what it uses, and panelizer does take overnode/{nid}/panelizer
.I expect this reaches
drupal_match_path()
, which I think secretly supports regular expressions.node/[0-9]+/panelizer*
may work. That's non-ideal since it is exploiting secret functionality, and maybe Panelizer can't assume entities have numeric IDs in URLs. I can't think of another way to be more specific about which paths are admin paths.Comment #9
DamienMcKennaSounds like this needs to go back to being a Panelizer issue then.
So it boils down to adding a hook_admin_paths() callback for the PanelizerEntityNode class and using a string that drupal_match_path() will accept.
Comment #10
DamienMcKennaSomething like this might work.
Comment #11
DamienMcKennaComment #13
neclimdulBranch didn't get switched back.
Comment #15
DamienMcKennaCommitted. Thanks drumm for the regex suggestion.
Comment #16
DamienMcKennaDarnit. I should have added tests first.
Comment #17
DamienMcKennaRolling back the change.
Comment #19
DamienMcKennaThe regex doesn't work because drupal_match_path() runs preg_quote() on the string, breaking the fancy regular expression.
Darnit.
Comment #20
DamienMcKennaComplete rollback, with the tests.
Comment #21
DamienMcKennaI've committed the changes above.
Should maybe d.o add this to a custom module?
Comment #23
DamienMcKennaMaybe it just needs to check the node_admin_theme setting?
Comment #24
DamienMcKenna@drumm: What is node_admin_theme set to on d.o?
Comment #25
drummnode_admin_theme is
0
Comment #26
DamienMcKennaAh! That explains it then.
This should cover it.
Comment #28
DamienMcKennaFixed the tests.
Comment #29
DamienMcKennaOk. This works. Thanks all.