Panels in Drupal 8
Don’t worry! We’re actively working on Panels for Drupal 8 in the d8panels sandbox, based on Tim Plunkett’s work on Page Manager for Drupal 8. This will have roughly the same architecture as Panels in D7. Our chief initial goal is to create a migration path from D7.
An Overview of Panels
The Panels module allows a site administrator to create customized layouts for multiple uses. At its core it is a drag and drop content manager that lets you visually design a layout and place content within that layout. Integration with other systems allows you to create nodes that use this, landing pages that use this, and even override system pages such as taxonomy and the node page so that you can customize the layout of your site with very fine grained permissions.
Integration with CTools module
Panels 3 utilizes the CTools' system of "context" so that the content you place on the page can be aware of what is being displayed. For example, in the existing Drupal setup, a block has no real knowledge of what the primary page is displaying. There are all kinds of tricks and tools you can use to get information to the blocks, but this generally means writing PHP code to scan the URL and pull the data out, which is not a very good thing when that data should already exist.
Panels uses Contexts - What are they?
In a Panel, you can create contexts, which represent the objects being displayed. For example, when displaying the node view, NID argument on the page is converted into a context through the 'arguments' system. You can then create a relationship from that node to, say, the node author, or if you have a node reference from CCK, a related node [as of CCK 2.3]. Once the contexts are in place, content specifically about those contexts can be placed. For the node context you can add CCK fields, the node body, attached files and a host of other information that can be provided by plugins. For the user context you can display things like the user picture or profile. Note that CCK 2.3 and later only has support for Panels 3.
In addition, these contexts can be checked for information and use that not only to make content available to be displayed, but to choose which layout to display! For example, if your site is international, you can use context to see if the node being viewed is set for a particular language and choose to display it one way if it is in French or another way if it is in English. You can also select on attributes like node type, whether or not the user has access to edit the node, and more. This system is also pluggable and you can add your own custom criteria with only a small amount of code. Want to display nodes differently based on how a custom CCK field you've added to a node type is set? That is very simple to write and you can use this to change the presentation entirely.
Panels also includes simpler applications of the drag and drop system. There is a node type (the 'panel' node) that can simply be added as content to your system. By being a node it loses a lot of the features that the more powerful page system has, but it does have the advantage of simplicity, and gaining all of the functionality that nodes normally get.
Panels can also be used for items smaller than pages. What if you have a normal sidebar, and you have two pieces of content that waste a bunch of space because they're really too narrow, and your design looks significantly better if they are side by side? That's complex to do in Drupal because what you end up having to do is create a custom block with custom code to display these two pieces of content. With Panels, you just create a "mini-panel" with a two column layout. Add one block to the left, one block to the right, and finish. This mini panel will then be available to your system as an ordinary block, or as panel content to go in the other panels.
Other Features of Panels
- Panels supports styles, which can control how individual content panes, regions within a panel, and the entire panel will be rendered. While Panels ships with few styles, styles can be provided as plugins by modules, as well as by themes!
- The layout builder is nice for visually designing a layout, but a real HTML guru doesn't want the somewhat weighty HTML that this will create. Modules and themes can provide custom layouts that can fit a designer's exacting specifications, but still allow the site builder to place content wherever you like.
- Panels includes a pluggable caching mechanism. A single cache type is included, the 'simple' cache which is time-based. Since most sites have very specific caching needs based upon the content and traffic patterns, this system was designed to let sites that need to devise their own triggers for cache clearing and implement plugins that will work with Panels. Panels can be cached as a whole, meaning the entire output of the panel can be cached, or individual content panes that are heavy can be cached.
- Panels can be integrated with Organic Groups through the og_panels module to allow individual groups to have their own customized layouts.
- Panels integrates with Views to allow administrators to add any view as content. Or, for uses where the layout editor needs more tightly controlled content, Views can be given custom displays to provide only what the site administrator wants the panels builder to use.
There's a text file inside of the panels module called known issues. Please read it. Thoroughly.
Status of Panels
The Drupal 5 and the version of Panels for it is dead. Don't use it.
Panels 3 is now at a stable release. It is feature complete and seems to be working very well. It is currently in need of stronger documentation. This will be going into the advanced help system over the next few months as time permits. Contributions to the documentation are welcome.
New releases will occur based on the amount of RTBC issues in the queue. We hope to get between 3 and 4 releases a year.