Ability of assign IDs to blocks

solipsist - August 23, 2006 - 11:55
Project:Block Region
Version:HEAD
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

There's currently no way to assign an ID to a block to be used in your CSS stylesheet to format different blocks in different ways, in order to for example change background, add icons or change block colors. Now the only option is to use a combination of the block's title and its module to create an id, which is rather ugly and is dependent on what the block's title happens to be. The delta cannot be used either as the site admin may want to change a block's weight.

I therefore suggest the blocks module includes an ID field for every block. The ID can either be specified by the site administrator in the block configuration (admin/block) or be auto-generated. A fresh Drupal install should include default IDs for the basic blocks so that themes can take advantage of this feature.

#1

nedjo - October 15, 2006 - 16:51
Status:active» closed

Well, Drupal core does add IDs to blocks by module and 'delta' (the ordinal integer assigned to the block in a given module). E.g.:

<div class="block block-user" id="block-user-1">

The id "block-user-1" is for the block from user module with the delta 1. So I think the case is covered, therefore closing this issue.

#2

solipsist - October 15, 2006 - 17:37

I moved this issue to core since blocks are part of core since many versions back. I was looking for better IDs that make more sense, semantically better, so to speak. If you're interested you can find the discussion there.

 
 

Drupal is a registered trademark of Dries Buytaert.