0

I'm using template_preprocess_panels_pane and I have custom css that need to be generated and inserted in the header depending upon data in the panels pane.

I can do drupal_add_css from template_preprocess_panels_pane, but in the situation that there are 20 panes that need custom css, it results and lots of duplicate data being added to the header. It would be cleaner if I could pass all of this CSS up to template_preprocess_page and add it to the header from there. Likewise, if I want to add data to--for instance--the page classes[] from template_preprocess_node (or whatever)....is there a way to achieve this?

Thanks!

2
  • if I understand what you're asking, no. not possible. the functions run in order, you can't go backward. if you re-word your question a bit we might be able to give you an answer that works though.
    – user5482
    Jun 24, 2015 at 19:43
  • Thank you for the response! Sorry if I couldn't word it clearly...to simplify the question, lets just say I want to set a class on the <body> object FROM template_preprocess_node. By the 'functions running in order' I assume that you mean it starts from the top down, ie preprocess_page runs before preprocess_node, and thus this isn't possible. If not, I can work with it, just wanted my code to be as clean as possible!
    – Pez
    Jun 25, 2015 at 20:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.