开发者

Drupal Module Themes - Default CSS?

开发者 https://www.devze.com 2023-01-04 01:55 出处:网络
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 开

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?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消