New in Panels 2: Mini Panels and Panel Styles

published on August 24, 2007

A couple of weeks ago, I agreed to work on the Panels Mini module, which would become part of the second version of Earl Miles’ outstanding Panels module. While working on that, I suggested to let modules implement styles for panels. (I was inspired by Nedjo RogersPanelsblock module, which sort of gives you “tabbed Mini Panels” for Panels 1). All you then would have to do, is: pick the Panel Style in the settings for the Mini Panel (or whatever other Panels implementation chooses to support it) and then change the CSS to get exactly what you want. This should prove to be a real timesaver.

More about Panel Styles I’ve written 2 Panel Styles so far:

Carousel Panel Style and Tabs Panel Style. The latter might be included in Panels 2. Both were sponsored by Paul Ektov.
To write a Panel Style, you only have to implement 2 hooks, or 4 hooks if you want to offer configuration options. Hopefully that will result in many contributed Panel Styles!

hook_panels_panel_style_info()
returns an array of Panel Styles that the module implements, along with some metadata
hook_panels_panel_style_render()
receives the Panel Style configuration and an array of (rendered) panes, returns the rendered HTML
hook_panels_panel_style_settings_form()
(optional) defines a form if your Panel Style supports some configuration options
hook_panels_panel_style_settings_validate()
(optional) validation function for the form of the previous hook

(Fancy?) Demo

Without further ado, a fairly fancy demo of all this.

I want this yummy stuff too! Where can I get it?

Mini Panels and the Panel Styles hooks are available in the Panels 2 CVS, and will be included in Panels 2 alpha 8 when it gets released. Be warned that Panels 2 is still a work in progress!

Comments

TUc's picture

TUc

Could you get the mini panels module to display a menu? For example: parent menulinks as tabs; children of the selected tab as content in the mini-panel The problem might be that you would want drupal to remember where you are on the site. If I’m not mistaken, panels resets the mini-panel on every page load. greetings, TUc

Wim Leers's picture

Wim Leers

For starters, this is definitely not the place to ask support questions.

Secondly, you haven’t even tried using Mini panels, because one of their primary goals is to be exposed as blocks and they can contain any content: menu’s, views, blocks, etc.

Please read the documentation next time ;)

Anonymous's picture

Anonymous

Hi, I need to implement a personal Panel Style in Panels 2 for D6, but I don´t know how to implement that 2 or 4 hooks. Could you provide me a page, of hook implementations for beginners.

Regards,

Wim Leers's picture

Wim Leers

It’s so dead simple that you should get it working by just looking at the small amount of code in Tabs Panel Style for example. And if you had searched properly, you’d have found http://doxy.samboyer.org/panels2/.

Comments on this post are now closed, to avoid any future lazy commenters.