1

The development house I work at uses Panels for stuff a lot, and they're a central design tool for our clients. While we're able to group our own Panels content types and View Panes by specifying a category name, it isn't so easy for everything else: there's the useless content types in the "Activity" category, the confusing content types in "Entity", the overwhelming and mostly-useless content types in "Node (Tokens)", the really useless content types in "Page elements" (Why would I need to repeat design elements already in place on the page?)... I could go on.

Plus random blocks are always dropped in the "Miscellaneous" category -- seemingly the last place I always look for content types I cannot find.

What I really need is the ability to organize Panels content types, and hide categories that aren't needed.

To that end I've started work on a module that lets the use build and organize Panels content types into custom categories. However, the first major roadblock I've run into is convincing Panels to use my layout instead of the one it generates from the plugin info hooks.

In panels/includes/add-content.inc is template_preprocess_panels_add_content_modal(), which is where Panels seems to set up its category tree (Via the function's $vars argument).

  1. Is there any way of inserting a hook into the function chain that discards the $var variable that Panels is passing to template_preprocess_panels_add_content_modal() and instead delivers my own?
  2. If not, is there a way to override template_preprocess_panels_add_content_modal() with my own version?
  3. Or, best yet, is there a module somewhere that already does what I'm trying to do?

Many thanks!

2
  • Just to be clear, you already know how to do hook_ctools_block_info, etc, for your organizing your custom stuff. You just want to organize the builtins?
    – mpdonadio
    Commented Jan 9, 2013 at 18:04
  • @MPD -- That is correct.
    – aendra
    Commented Jan 9, 2013 at 18:43

1 Answer 1

2

"Whaddayamean you can override functions starting with 'template' like you can functions starting with 'hook'?" I ask...

I've finished my organizer and will post it as a sandbox module if my boss lets me. I ultimately just copied the source of template_preprocess_panels_add_content_modal() from panels/includes/add-content.inc and changed what was passed on -- $vars['categories'], $vars['categories_array'] and $vars['root_content'] were particularly important.

Surprised nobody answered this -- would've been an easy 10 points to just say "Yeah, template_preprocess functions work a bit like hooks in that you can insert your own version higher up the chain just by naming it a certain way..."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.