moving stuff around on your drupal web pages alex bergin / @alexbergin@alexbergin dept. agriculture...

Post on 31-Mar-2015

216 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Moving stuff around on your Drupal web pages

Alex Bergin / @alexberginDept. Agriculture & Food

@drupalwa

Background

• Websites are dynamic that’s why we’re here, that’s why we use Drupal.

• Not all pages will want to look the same

@drupalwa

@drupalwa

Scenarios

• 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.

@drupalwa

SO HOW DO WE DO THIS IN DRUPAL?

@drupalwa

Blocks

@drupalwa

Blocks

• 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.

@drupalwa

Options

• Various contributed modules make layout management easier:1. Panels: http://drupal.org/project/panels2. Context: http://drupal.org/project/context3. Display Suite: http://drupal.org/project/ds

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

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

Or perhaps only node content

@drupalwa

1. Panels Module

Screenshot courtesy of themonthly.com.au

@drupalwa

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.

@drupalwa

@drupalwa

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.

@drupalwa

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 module.

@drupalwa

More on Panels

• Panels designed to be very extendable and powerful.

• 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

@drupalwa

2. Context

@drupalwa

2. Context

• Around since D5.x, fairly mature.• Comes with Context, Context Layouts, Context

UI. • Create contexts by specifying conditions and

then the reactions – be it blocks to show in a region.

• No field support though.

@drupalwa

2. More on Context

• Relatively easy interface to manage.• Addons for Context:– http://drupal.org/project/context_node - lets the

content creator select which context to use for their node.

– http://drupal.org/project/context_by_node - automatically creates a context when the node is created (no official 7.x version available though).

@drupalwa

3. Display Suite (DS)

@drupalwa

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 manually.

• View modes. i.e. Event has a full, teaser and monthly calendar view.

@drupalwa

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.

@drupalwa

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:

http://bit.ly/ds-d7

@drupalwa

So what to use then?

• Based on Number of Installs:1. Panels: 120,0002. Context: 65,0003. Display Suite (DS): 30,000

All growing, but DS growing the fastest.

@drupalwa

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.

@drupalwa

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.

@drupalwa

Further Info

• Blocks vs. Context vs. Panels: http://www.lullabot.com/articles/assembling-pages-with-drupal

• Comparison of Layout Editors: http://groups.drupal.org/node/15851

• DS vs. Panels: http://www.jyvesgarden.com/blog/display-suite-vs-panels

• Great DS instructional videos: http://bit.ly/ds-d7

@drupalwa

What’s ahead

• Drupal 8 Initiatives: “Concept Model”• Thomas, Sam, anyone read up on this, please

share?• D8 discussions on the topic is found here:

http://groups.drupal.org/node/227543

@drupalwa

Cheers to Thomas for organising these meetups month in month out!

top related