Moving stuff around on your Drupal webpages

Moving stuff around on your
Drupal web pages
Alex Bergin / @alexbergin
Dept. Agriculture & Food
• Websites are dynamic that’s why we’re here,
that’s why we use Drupal.
• Not all pages will want to look the same
• Websites may have:
– Homepage presenting a dashboard of content.
– Content Pages: Basic pages, products, events, etc.
– Index taxonomy term pages, landing pages.
– Search results, sitemaps.
– User profile pages.
– And more!
• All of which may have different layouts.
Baked into Drupal core since 4.x.
Manage blocks in your themes regions.
Suited for basic brochure sites.
Problem: dozens of blocks for dozens of
regions, not enabled for all pages?
• Problem: visibility conditions limited. Php in
db bad mkay.
• Various contributed modules make layout
management easier:
1. Panels:
2. Context:
3. Display Suite:
We’ll try go over each of these.
What do they basically do though
Everything on the page
Or, all theme’s body
content region
Or perhaps only node
So you can use these modules in conjunction with Blocks and your
theme regions, if you want to.
Additionally, these things modules can use block content defined by
other custom modules, themselves too
1. Panels Module
Screenshot courtesy of
1. Panels explained
• By the same legend as the Views module –
Earl Miles (aka merlinofchaos). Since D4.7.
• Dependant on Ctools which includes the Page
Manager module that is kind of required to
use Panels.
• Panels module includes several modules:
Panels, Mini Panels, Panel Nodes, and In-Place
Panel Editor.
1. Panels explained. More..
• Panels is path driven. So a panel object exists for nodes, node
edit forms, search, etc.
Panels has its own terminology
• Of each panel, you have Variants, which each
let you have different layouts, e.g. One for
each content type.
• Each Variant can have a Layout set. Use built
in panels layouts or write custom layout.
Panels has its own terminology
• Selection Rules, lets you define conditions in
your Variants, e.g. Different layout for a
different node content type.
• Contexts – allows you to draw on other
material: content, views, etc. i.e. Product
panel variant bring postage conditions node
into context. Not to be confused with context
More on Panels
• Panels designed to be very extendable and
• Advanced plugin system via ctools for custom
access controls, layouts, content blocks
(content types), and block styles.
• Modules that extend Panels:
– Panels Everywhere
– Panelizer – like panel_node module
2. Context
2. Context
• Around since D5.x, fairly mature.
• Comes with Context, Context Layouts, Context
• Create contexts by specifying conditions and
then the reactions – be it blocks to show in a
• No field support though.
2. More on Context
• Relatively easy interface to manage.
• Addons for Context:
– - lets the
content creator select which context to use for
their node.
– automatically creates a context when the node is
created (no official 7.x version available though).
3. Display Suite (DS)
3. Display Suite
• Stable. Relatively new. Still catching on.
• Specially built for Drupal 7 Entities: nodes,
users, terms, etc.
• Layouts – includes common layouts, but easy
to create new layouts by drush instead of
• View modes. i.e. Event has a full, teaser and
monthly calendar view.
3. Display Suite
• “Disable drupal blocks/regions” setting.
• DS Custom Fields (not content fields) lets you
create more flexible fields:
– Code field - meta tags, tokens, php field.
– Dynamic field – kind of like panels context.
– Block field - how you add other module blocks
“block fields”.
– Preprocess fields – possibly lets other modules
populate them? Haven’t used this myself.
3. Display Suite – Advanced Stuff
• Integration with panels layout manager.
• Integration with Views Displays.
• Re: Custom layouts with Drush, look for the
“ds-build” argument in Drush help.
• Very decent screencasts here:
So what to use then?
• Based on Number of Installs:
1. Panels: 120,000
2. Context: 65,000
3. Display Suite (DS): 30,000
All growing, but DS growing the fastest.
So, what to use?
• Depends on your circumstances.
– Basic Brochure site – blocks
– For larger sites though:
• Panels is probably the most powerful, but has a steep
learning curve.
• Context is probably the easiest of the lot to learn but
still requires templating for laying out field content.
• Display Suite looks like it has a good balance of
usability, and power. Probably the most exciting.
What to use, Continued..
• All are Exportable to features.
• One way or another it’s probably possible to
do anything in any of the layout modules.
Further Info
• Blocks vs. Context vs. Panels:
• Comparison of Layout Editors:
• DS vs. Panels:
• Great DS instructional videos:
What’s ahead
• Drupal 8 Initiatives: “Concept Model”
• Thomas, Sam, anyone read up on this, please
• D8 discussions on the topic is found here:
Cheers to Thomas for organising
these meetups month in month out!

similar documents