Block Class

Slug: 
block_class
Versions de Drupal: 
6.x
D.o - Installation Rank: 
126
D.o - Reported Installs: 
6 364
D.o - Maintenance Status: 
Seeking co-maintainer(s)
D.o - Development Status: 
Under active development
D.o - Module Categories: 
Content, Content Display, Theme Enhancements
D.o - Download 6.x: 
6.x-1.3|http://ftp.drupal.org/files/projects/block_class-6.x-1.3.tar.gz|8.39 KB
D.o - Original Description: 

Block Class allows users to add classes to any block through the block's configuration interface. By adding a very short snippet of PHP to a theme's block.tpl.php file, classes can be added to the parent <div class="block ..."> element of a block. Hooray for more powerful block theming!

Installing the Drupal 7.x version

  1. Enable the module
  2. To add a class to a block, simply visit that block's configuration page at Administration > Structure > Blocks

Installing the Drupal 6.x version

  1. Enable the module
  2. Add this snippet to your theme's block.tpl.php file (see detailed instructions below): <?php print $block_classes; ?>
  3. To add a class to a block, simply visit that block's configuration page at Administration > Site Building > Blocks

How to add the PHP snippet

Here's the first line of the Garland theme's block.tpl.php prior to adding the code:

<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="clear-block block block-<?php print $block->module ?>">

And here's what the code should look like after adding the snippet:

<div id="block-<?php print $block->module .'-'. $block->delta; ?>" class="clear-block block block-<?php print $block->module ?> <?php print $block_classes; ?>">

IMPORTANT: Remember to separate the PHP snippet from the existing markup with a single space. If you don't add the space, your CSS classes could run together like this: block-modulecustomclass instead of block-module customclass.

Credits

Four Kitchens logo

Development of this module is sponsored by Four Kitchens.

Souscrire à DrupalFrance.com RSS