There's tons of documentation out there on how to override the appearance of Drupal modules, but I keep finding the docs for writing the original theme to be a little lacking. On this note, how can I tell Drupal to use a specific CSS file for my custom module's block output?
A:
For blocks, you may find good use in the block class module.
http://drupal.org/project/block_class
If your module is outputting a block, it should have an ID from block.tpl.php output which is prime for overriding. You can also assign a class or ID scheme from your module which will also assist in theming.
Kevin
2010-06-18 00:38:49
I don't want to override! I'm trying to implement a default theme for the block, not in a separate site-wide theme.
derekerdmann
2010-06-18 00:46:16
Whatever theme you are using should have baseline css defined for blocks.. and thats the theme. To change it you have to override it or change the CSS. That or I don't fully understand your question. You can add more stylesheets to your theme with drupal_add_css and _preprocess functions in template.php
Kevin
2010-06-18 04:02:14
A:
You can add a custom css for your module, in your module code (rather than the theme), by using drupal_add_css
. Example from hook_init
in admin_menu module:
$path = drupal_get_path('module', 'admin_menu');
drupal_add_css($path .'/admin_menu.css', 'module', 'all', FALSE);
If you just want custom css at the theme level, then add a reference to the css path in your theme's .info file.
cam8001
2010-06-18 08:41:22