One reason for me to use nodeblock module is that it allows html in the block title - unlike the native Drupal blocks, which escape the title. Typically, I want to add some span tags to give some elements in the block title a different font size or color.
The downside is that now the escaped html tags appear in node and block listings, and in the edit page itself.
A nice solution would be to use a CCK field as the block title.
A simple and flexible way to do that with nodeblock would be to give the $node variable to the block template, so it can be used in theme preprocess functions for block.tpl.php.
In nodeblock.module:
<?php
function nodeblock_block($op = 'list', $delta = 0, $edit = array()) {
[..]
$block['subject'] = $node->title;
// using page arg = TRUE since we want the full content (generally speaking)
$block['content'] = node_view($node, FALSE, TRUE, TRUE);
$block['nodeblock_node'] = $node;
return $block;
}
}
?>Another solution would be to make a function theme_nodeblock_subject($node) that would by default use the node title as the subject.
Comments
Comment #1
donquixote commentedI found a very easy solution that requires a minimal patch.
In nodeblock.module, starting with line 121 (function nodeblock_block).
Old code:
New code:
Now you can manipulate $node->title in your template or theme function, using the cck fields of your choice.
It's a bit odd, yes, but it works!
Comment #2
donquixote commentedI think the following is more useful:
Comment #3
tom_o_t commentedSee related issue http://drupal.org/node/473742
Comment #4
Johnny vd Laar commentedI've added an improvement in the Drupal 7 version. I won't include this in Drupal 6:
http://drupalcode.org/project/nodeblock.git/commit/5afcb66
Comment #5
donquixote commentedHi,
The use case I had when I opened is now long ago, I don't even remember it - so I can't give much feedback atm.
I still want to say thank you for picking it up :)