I've got my main block region which is grid-16. Now I'd like each blocks inside it to automatically receive a grid-3 class. What's the best practice to do so?

Comments

dvessel’s picture

The easy way is to create a new template based on "block.tpl.php" named after the region your targeting. Example: block-content.tpl.php. Make sure it lives in the same directory as block.tpl.php within your theme.

From there, simply add the grid class to fit the width.

The harder way is to override the theme function "theme_blocks" (plural) where each block within a region is invoked and keep track how many are being processed for a given region. With that information, you can add dynamic classes to each block instead of a simple "grid-3" which may not always fit.

Kendall Totten’s picture

Component: Code » Documentation

One of the biggest aha moments I've ever experienced was discovering the Block Class module:
http://drupal.org/project/block_class

It was also the missing piece in figuring out how to work with the Zen NineSixty theme. I wrote up a few notes on the working with the grid theme here: http://switchbackcms.com/blog/zen-ninesixty-theme

Hope it helps!

-Kendall

dvessel’s picture

Status: Active » Fixed

Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.