Here is a setup where this issue is visible:
- There is a different admin theme defined in admin/appearance
- i'm using a custom "path prefix" purl provider/modifier, let say "section1" and "section2"
If I access an administration page while being on a "section1/2" page then the normal theme is used instead of the one defined in admin/appearance.
/admin/structure => admin theme
/section1/admin/structure => normal theme but it should be the admin theme
For reference, here are some function involved in this (all in /includes/path.inc):
- path_is_admin($path)
- hook_admin_paths()
- hook_admin_paths_alter()
The path_is_admin function is called from /module/system/system.module, in the system_custom_theme function.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | purl-1693984-10.patch | 841 bytes | star-szr |
| #10 | interdiff.txt | 785 bytes | star-szr |
| #6 | 1693984-6-purl-show_admin_theme_with_path_prefix.patch | 1.02 KB | pfrenssen |
| #1 | 1693984-1-purl-show_admin_theme_with_path_prefix.patch | 1.78 KB | isolate |
Comments
Comment #1
isolate commentedImplemented hook_admin paths so that all path prefixes with links to admin paths are being added to the admin paths.
Comment #2
idflood commentedThanks iSoLate, nice patch :)
I've tested it and it fixed my issue + the code looks great.
Comment #3
pfrenssenI am getting this warning when using this patch:
But this appears to be due to a problem in Drupal core: #1783704: drupal_match_path() fails on large matching patterns.
Comment #4
sultancillo commentedI get a fatal error with this patch:
maybe this makes purl run before before ctools is nice and ready?
Comment #5
pfrenssen@sultancillo, you seem to have hit this issue: #1882980: ctools_get_plugins() is called without including plugins.inc.
Comment #6
pfrenssenThe proposed patch for Drupal core from #3 is rejected so we need an alternative approach. Rather than adding on every path modifier to the list of admin paths, this provides our own implementation of hook_custom_theme(). This seems to be the right way of doing this as there is no way to pass the right path to system_custom_theme() as it runs before purl_init() in the bootstrap.
Comment #7
djdevinIsn't the permission "access admin theme" not "view the administration theme" ?
Just updated it manually and now I have admin themes in purl-enabled learning groups (also for group admins who get granted the "access admin theme" inside of a group.
Comment #8
liquidcms commentedpatch from #6 and fix from #7 worked for me.
Comment #9
pfrenssenMarking as needs work as per #7.
Comment #10
star-szrThanks @pfrenssen :)
'view the administration theme' is correct, at least for Drupal 7 core's admin theme implementation. I think 'access admin theme' is from this module: https://drupal.org/project/admin_theme which I have never used. I successfully tested the patch from #6 with og_purl and OG 7.x-2.x.
Maybe something like the attached could satisfy both use cases.
Comment #10.0
star-szradded info about where path_is_admin is called
Comment #11
muschpusch commentedpatch looks good an works as expected!
Comment #12
kristiaanvandeneyndeFixed in #2599098: PURL activated too late..