Right now I'm using Bartik which doesn't have a block.tpl.php file. Should I create one? What should be in it? How do I override the '.sidebar' class that blocks are getting. Even an !important doesn't seem to force the use of custom classes.

Thanks.

Comments

dydave’s picture

Component: Documentation » Miscellaneous
Category: task » support
Status: Active » Fixed

Hi thinguy,

Thank you very much for posting this support request.

I think your questions and issues are more related with common Drupal Theming practices than the Block Class module itself.
I would strongly advise you try looking closer at existing Theming documentation, in particular: Drupal Theming Guide.

However, for a quick starter, please allow me to answer your questions in short:

Right now I'm using Bartik which doesn't have a block.tpl.php file. Should I create one? What should be in it?

Sure. You can always create new template files in your theme (custom or not) to override system's or contributed modules' defined template files.
The file you would like to override is related with the Core Block module, therefore if you wanted to find the original template file, you would have to look at the block.tpl.php file in the Core Block module folder (/modules/block/block.tpl.php).
To override this file in your own theme, copy it under the /themes/bartik/templates theme folder.

How do I override the '.sidebar' class that blocks are getting. Even an !important doesn't seem to force the use of custom classes.

I'm not exactly sure what could be the problem here, since you could certainly use IDs, or other CSS classes perhaps deeper in the HTML DOM Tree....
Modifying the theme file (as suggested above) to add your own custom markup would also work....
I've personally never had any issue for theming with some of the existing classes and always found it really flexible to add hard coded class names or markup (whether in code or DB, through modules or not).
Indeed, I've never found myself in a situation where I had to use the !important in any CSS files, except for very special cases involving heavy use of JS or special libraries, but I don't think that's the case here.
 

I hope I was able to answer your questions, so I allowed myself to mark this issue as fixed for now, but feel free to re-open it, or post a new ticket, at any time if you have any further questions or still encounter any issues with the Block Class module (we would surely be happy to hear your feedback).

Please let me know if you would have any further comments, feedback, questions, issues, objections, suggestions or concerns on any aspects of this ticket in general, I would be glad to provide more information or explain in more details.

Thanks again to everyone for your help, reviews, feedback and comments on this issue.
Cheers!

Status: Fixed » Closed (fixed)

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