0

I'm tying to show all the taxonomy terms from a specific vocabulary linked to the current node being viewed. I'm doing this with a new block defined in my module.

In my hook_block_view i need to give a $block['content'] a value, i'm putting a 'foobar' in it because i won't use it, and i add a new key 'tags' which is a array with my tags to render. Then in my block.tpl.php i check the block name and change the rendering if my custom block is rendered.

I guess there must be a better way of doing this...

I would love to add a custom template file, that will be used on my specific block. Is this possible?

Thanks, Jonathan

1
  • I'm using Drupal 7
    – jivanrij
    Jun 28, 2012 at 8:38

1 Answer 1

-1

This is a good article on what trying to do...

http://www.pixelclever.com/how-theme-specific-blocks-drupal

7
  • does not seem to work :( Added a template with the name block-modulename-delta.tpl.php but Drupal didn't picked it up.
    – jivanrij
    Jun 28, 2012 at 8:38
  • Make sure you have block.tpl.php in your theme folder. Also you will need to clear caches so Drupal recognizes the template you have added.
    – Alex Gill
    Jun 28, 2012 at 8:49
  • Yes i had/done that.
    – jivanrij
    Jun 28, 2012 at 9:26
  • Put this in your theme template... function YOUTHEME_preprocess_block(&$vars) { print_r($vars['theme_hook_suggestions']); } This should show you what the template should be called.
    – Alex Gill
    Jun 28, 2012 at 9:40
  • Great :) This gave me some more block info, and i got it to work by adding a template. Basically with the block--module--delta.tpl.php name. Thanks!
    – jivanrij
    Jun 28, 2012 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.