Is Hitler really happy?

(If you don't get the title, watch this video.)

With the recent release of CTools/Panels alpha for Drupal 7, fears that Drupal 7 would have to go a long time without one of the more popular add-ons has been silenced. If Panels aren't ready on the D7 release day, it shouldn't be far behind.

So Hitler is happy, as is a lot of users and site builders.

However, Hitler might throw another fit when he starts building his first D7 site and he finds out that CTools/Panels haven't quite drunk the D7 Cool-Aid fully.

If the current alpha is anything to go by, it doesn't use the new convention of returning a render array, which kills the utility of hook_page_alter. With a standard /node view, you get a 'content' region that has the node list as an array of sub render elements, allowing you to go down to $page['content']['system_main']['nodes'][6]['links']['#links']['comment-add'] and do horrible things to it. With the Panels alpha, you get $page['content']['system']['main']['#markup'] which contains the whole rendered panel. Considering that Panels is often used in a configuration where it takes over from the usual Drupal block system, you're left with a crippled hook_page_alter.

While some might not view this as a big loss, the whole hook_page_alter does taste a bit hacky, it's unfortunate that the panels aren't proper render arrays, to fit in with the rest of Drupal. Thankfully, the CTools content_type render function, while unfortunately named in light of the new D7 render function, may return a render array as the pane content.

I do appreciate why Merlin & Co. is concentrating on getting a working Panels out for D7 (the "D7 port" issue in the Panels queue is probably in the top 10 most duplicated issues), and only time will tell whether it'll be an issue at all. One could make the case that most things you might want to do with hook_page_alter is better off done in Panels itself, and for the content of the panels there's other options.

But if you hear ravings from der Fürer-bunker, you'll know why.

Blog tags: