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.

Comments

isolate’s picture

Status: Active » Needs review
StatusFileSize
new1.78 KB

Implemented hook_admin paths so that all path prefixes with links to admin paths are being added to the admin paths.

idflood’s picture

Thanks iSoLate, nice patch :)
I've tested it and it fixed my issue + the code looks great.

pfrenssen’s picture

I am getting this warning when using this patch:

Warning: preg_match(): Compilation failed: regular expression is too large at offset 39102 in drupal_match_path() (row 331 of includes/path.inc).

But this appears to be due to a problem in Drupal core: #1783704: drupal_match_path() fails on large matching patterns.

sultancillo’s picture

I get a fatal error with this patch:

Fatal error: Call to undefined function ctools_get_plugins() in sites/all/modules/purl/purl.module on line 453

maybe this makes purl run before before ctools is nice and ready?

pfrenssen’s picture

@sultancillo, you seem to have hit this issue: #1882980: ctools_get_plugins() is called without including plugins.inc.

pfrenssen’s picture

The 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.

djdevin’s picture

Isn'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.

liquidcms’s picture

patch from #6 and fix from #7 worked for me.

pfrenssen’s picture

Status: Needs review » Needs work

Marking as needs work as per #7.

star-szr’s picture

Status: Needs work » Needs review
StatusFileSize
new785 bytes
new841 bytes

Thanks @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.

star-szr’s picture

Issue summary: View changes

added info about where path_is_admin is called

muschpusch’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

patch looks good an works as expected!

kristiaanvandeneynde’s picture

Status: Reviewed & tested by the community » Closed (duplicate)