Voting starts in March for the Drupal Association Board election.
Context Block Class gives users of the Context module the ability to define custom classes for blocks per context, both for each block and globally for a region. The module implements a context reaction, providing the interface required for adding classes to blocks which have been defined for that context. This unlocks a tremendous amount of theming flexibility for users of Context module. When combined with a grid based theme or any other theme which implements re-usable styles, the options are endless!
- Enable the module.
- Ensure that your theme has a copy of block.tpl.php.
- Insert a PHP snippet to your theme's block.tpl.php file(s) that prints the $context_block_classes variable (see below).
- To add a class to a block or to all blocks within a region, add the "Block classes" reaction to your context.
Adding the php snippet
Add this snippet to your theme's block.tpl.php inside the block's class definition:
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 $context_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".
Development of this module is sponsored by Advantage Labs, Inc.
- Maintenance status: Actively maintained
- Development status: Unknown
- Module categories: Content Display, Theme Enhancements
- Reported installs: 13 sites currently report using this module. View usage statistics.
- Downloads: 1,200
- Last modified: November 27, 2014
- This project is not covered by the security advisory policy.
It may have publicly disclosed vulnerabilities. Use at your own risk!