31

I'm writing this question, because I see confusion all over the Drupal community about "what is Page manager", and "what is Panels".

2 Answers 2

49

Ctools

In Ctools, there is a sub-module called "Page manager". This module, at it's core, is a graphical user interface to hook_menu. It allows you to either create new paths in the system, or take over some of the ones provided by Core.

Page manager

Once Page manager manages a path for you, it can do several different things with it. Out of the box, it can provide redirects for you. One common use case for this, is to deny access to nodes that lack proper theming because they are not meant to be viewed on their own, such as "Fact boxes" or "Image nodes". Another is to redirect from a term view to a Solr search of the same term.

One of the main benefits of Page manager, is that it introduces a way of dealing with "Context", not to be confused with the module Context. The kicker here, is that Panes, which are "slightly smarter blocks", can declare their dependencies to the system, and them have the actual arguments (called Contexts) passed in dependency injection-style.

For those unfamiliar with DI, but familiar with Drupal, this, for example, allows you to never need to use menu_get_object again to get "That one and only node referenced from the menu path". What if there's more than one node in the path? Or if you really want to base the block on a node from an entity reference? This becomes a non-issue with Page manager, making all blocks (panes) much more flexible and re-usable.

Panels

The most common use case however, is to hand over the layout, and rendering of the path, to Panels. Panels provides tools to define layouts, either in code or directly in the browser, and the lets you place content directly in the browser.

Conclusion

Both of these modules are very powerful, and relatively poorly documented, which has lead a lot of people to be frustrated about them. Understanding how to use them is however well worth it if you are building a larger site, especially since their approach to handling "pages", as well as layout, looks like they are going into Drupal 8 core, courtesy of EclipseGC's SCOTCH initiative. Relevant sandbox project

Further reading

Examples of other interesting things one can do with these tools:

  1. If Context is used as a sectioning tool, Panels can work in tandem with it and be used as a layout tool.
  2. Panels can interact with Display suite to provide it with a nice drag-and-drop UI.
  3. Page manager and Contextual Administration can help building in "Context" sensitive menues and other helpful things for site admins/editors.
2
  • 3
    I've never really understood/used page manager - it's great to know what it's (basically) for. Thanks for the brief write-up!
    – Chapabu
    Commented Jun 26, 2012 at 20:50
  • 2
    $page_data = page_manager_get_current_page() is where the money is at, especially $page_data['handler']
    – mpdonadio
    Commented Jun 26, 2012 at 21:06
1

In Drupal 7, Page Manager was the foundation of the Panels module.

"Learn Page manager" is an interesting (and amazing) set of videos. They contain various topics related to the Panels module. Here is a summary of the entire set of videos about this topic (quote from the link above):

  • Page manager allows you to collect and manage contextual information in a flexible and consistent way. It is an important part of building infrastructure on Drupal websites, and you should know how to use this module.
  • The screencast series is targeted at experienced Drupal developers.
  • Episodes 1, 2 and 3 introduces the most basic concepts, such as custom pages, variants, selection rules and (to some extent) contextual objects.
  • Episodes 4, 5, 6 and 7 talk about Panels, with emphasis on Views integration but also some words on efficient caching.
  • Episodes 8 and 9 about access control, menu items, and not least the little-known but very useful Contextual Administration module.
  • Episodes 10 and 11 talks more about using contextual objects in Page manager, including using Views as context. This is, imho, where the real power in Page manager is.
  • Episodes 12 and 13 collects various bits and pieces, such as how to use Panels to easily rearrange the node edit form, import/export settings, and some extra modules that can be used with Page manager.

Refer to Explaining Panels: An Overview for Drupal Developers for another great explanation about the Panels module.

The future of Page Manager

In Drupal 8, Page Manager has become a separated module, while formerly (up to Drupal 7), it was part of the CTools module. Here are some more quotes from the (D8 related) project page:

It supports the creation of new pages, and allows placing blocks within that page.

Like Drupal 7's Page Manager, it provides a concept of "page variants", each with their own selection conditions.

Additionally, it can be used to take over an existing page, like overriding /node/% to change what is displayed when viewing a node.

It utilizes the core Conditions, Context, and Blocks APIs to accomplish this.

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