Explaining the Panels module

Welcome to this week’s Secret Sauce, a short podcast by Palantir.net that offers a quick tip on some small thing you can do to help your business run a little bit better. Today’s advice comes from one of our colleagues at Pantheon. Steve Persch is an Agency and Community Engineer at Pantheon and former Palantir team member, and he’s sharing his thoughts on using the Panels module in Drupal.Transcript SP: Hi, I’m Steve Persch. Today I’m going to be talking about Panels Module in Drupal.  So I use Panels Module because I think of it as a really direct way of doing style guide driven development, which is a topic that’s getting discussed a lot in the Drupal community these days. Style guide driven development is the idea that development is directed by a style guide understanding of how a site is put together. What I mean by that is components like global headers, global footers, the styling of teasers, the styling of common article header elements is a really accessible way for clients, for stakeholders to conceptualize the visual understanding of a site.  So if you’re starting at that point with a style guide and you’re working in Drupal, it can be difficult to make Drupal match the markup that’s present in the style guide. A lot of Drupal developers like to complain about the CSS classes, the excessive wrapping divs that come from Drupal, and there’s this pain point of “how do we get Drupal to print the markup that we want.” At DrupalCon Los Angeles I did a presentation called Rendering HTML with Drupal: Past, Present and Future. Anyway, in that I described how in earlier versions of Drupal it was really common to just take whatever markup you get from Drupal and write CSS against that. It may have too many divs, too many classes . . . it doesn’t matter, just write CSS against it. As we move towards this world where where we’re doing more style guide driven development, we generally don’t want the markup that comes out of Drupal by default. Here’s where Panels Module comes in. Panels Module, I think, is a great mapping layer between Drupal’s internal understanding of elements like nodes, like headers and blocks, and that style guide understanding. So Panels has this concept called the Layout PlugIn. The Layout PlugIn is that mapping layer between a Drupal template file and the style guide design component. So you may have a Layout PlugIn called Global Header, and that’s your global header design component. You can then use that Global Header layout plugin at all these different layers of Panels. There are four main layers of Panels that I like to use. There’s the Mini-Panels Layer, which is analogous to core’s block system. A mini-panel is basically an individual block, so you make an individual block, and that’s your site header. You can look at that mini panel and you can see this uses the global header design component and that becomes a mapping layer between . . . all right, we had this understanding of a design component called a global header, and we had to plug in all this Drupal data like search forms, like menus . . . Panels is a user interface that lets you insert all of that Drupal data into a template that you can still think of as an independent design component. Doing that in traditional Drupal is really hard conceptually because in a more traditional Drupal build, the header might just be a conglomeration of things in the global template file, your page.tpl file. And it’s hard to keep track of where does this design component start and stop? Is there even a single representation of the header, or is it just a mix of menus that are thrown into the global template?  So with Mini-Panels you can encapsulate blocks. With the Panelizer level, you can encapsulate view modes. Panelier is essentially an alternative user interface on top of Core’s view modes. So in Drupal Core you have the ability to say, “this article teaser is going to display these fields in this order, drag and drop . . . co

Om Podcasten

We interview our clients, peers, and resident Palantiri who work in web technology, strategy, and design, often with those who work in the open source community.