Closed (fixed)
Project:
IMCE
Version:
7.x-1.5
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 Aug 2012 at 21:21 UTC
Updated:
31 Jul 2020 at 17:54 UTC
Jump to comment: Most recent
I am trying to do some customization of the IMCE interface, but it looks like hook_preprocess_page does not run in IMCE pages such as mysite.com/imce
You can verify this by adding die() at the beginning of any hook_preprocess_page call, and load the imce page.
I see there are some IMCE template files, but I'd like to add a CSS reference to the head, among other things, and would rather not hard code that reference in IMCE's page template.
Comments
Comment #1
ufku commentedIMCE page is created by theme('imce_page'), so the hook to be invoked is hook_preprocess_imce_page()
Comment #2
arnoldbird commentedtheme('imce_page') provides the contents of the page, but not the whole page (in the usual Drupal sense).
Looks like the reason hook_preprocess_page does not run is because of the call to exit() in imce(). Instead of returning a renderable array in the usual Drupal 7 way, this page callback prints the page contents and then exits:
Comment #3
arnoldbird commentedLooks like it's possible to create a page in a custom module that uses imce_content() to output the IMCE browser in the page content. Something like this...
Initially it seems to work.
Comment #4
arnoldbird commentedThe approach in #3 works, to some extent, but looks like it will have to be further customized for different situations. For example, when IMCE is used in an image field. Going back to the original issue, I'm not sure what we gain by printing the IMCE output and exiting, rather than returning the output (and thus handing things off to Drupal's presentation layer in the usual way). It's possible there is something I'm overlooking, but the non-standard approach to rendering the page doesn't have any advantages that I can see and makes theming much more complicated, for those who need to theme the IMCE browser.Nevermind the above. I think the reason IMCE is not working in an image field is due to a bug in another module. It's not related to the print & exit in IMCE.
Comment #5
thallesI think this was solved!
Comment #6
thalles