Active
Project:
AdaptiveTheme
Version:
7.x-3.x-dev
Component:
Theme Settings
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
29 Mar 2013 at 11:19 UTC
Updated:
10 Apr 2013 at 01:58 UTC
I am trying at add the following code within the adaptivetheme_preprocess_block(&$vars) in the atcore preprocessblock.inc for use with a sub theme
{/* Set shortcut variables */
$block_id = $vars['block']->module . '-' . $vars['block']->delta;
$classes = &$vars['attributes_array']['class'];
/* Add classes based on the block delta */
switch ($block_id) {
/* Add .badge class to block #14 */
case 'block-14':
$classes[] = 'badge';
break;
/* Add .form class to block #20 */
case 'block-20':
$classes[] = 'form';
break;
}
}
I want a way to add a class to blocks I create so I can theme against this class rather than block I'd which may change when I apply the theme to other sites. Just looking door guidance as to the simplest way of doing this please
Comments
Comment #1
artatac commented...blocks
Comment #2
Jeff Burnz commentedThe code is illogical in terms of the issue, you switch on ID, isn't that what you are trying to avoid?
Also why hack the core theme, just use preprocess in your subtheme.
Comment #3
artatac commentedGood point I will add it to the sub theme.
The reason for I'd is that as far as I am aware all I know about the block I want the style, that is unique, is block-block-12 and I wanted to add a class say block-teammembers and style that. I came across the above code and hoped hat would do it for me.
Comment #4
ydahithere's a module for that: http://drupal.org/project/block_class