[drupal-devel] Theme function for outputting block links

Gabor Hojtsy gabor at hojtsy.hu
Wed Jan 19 12:44:47 UTC 2005


>>>     What I'm thinking is probably more along the lines of a new 
>>> hook,  rather  than theming.  So, we'd have hook_block_links (or 
>>> extend  hook_links to  have a binary block parameter), which would 
>>> allow all  modules to add links  to specific blocks.  Then, those 
>>> links would be  passed to theme_links,  which would do its work.
>>>     I think this is more than a CSS issue, as most links should be  
>>> wrapped in  some block level element.  Weblink.module is currently  
>>> inserting its own  HTML to do this.
>>
>> -1 on this..
>> We output a unique id for each block, which helps us to theme the  
>> various blocks in a unique way..
> 
>     Fair enough, but there's no clean way for a module to output links  
> specifically for a block.  And, AFAICT, any links that are output now 
> are  stuck in module-specific markup.  Isn't consistency a good thing?

Is it cleaner to

-------------------------------------------------------8<------------
   if (enabled(comment module)) {
     add comment links
   }
-------------------------------------------------------8<------------

in a module OR

-------------------------------------------------------8<------------
   $output .= call_hook("add block links", "blockname", "block delta");
-------------------------------------------------------8<------------

in that module and

-------------------------------------------------------8<------------
   function comment_add block links($name, $delta) {
     if (this_block_needs_to_have_comment_links($name, $delta)) {
       return comment links
     }
   }
-------------------------------------------------------8<------------

in the comment module? Now the modules know what their blocks should 
contain, and on what else they depend on. Now you say it would be better 
if comment module would know what else depends on it (even contrib 
modules?). I doubt it.

Goba



More information about the drupal-devel mailing list