0

I want to use the title of the block as a hyperlink (or maybe adding an image) and I do not know how can I do this.

I've been looking to block.tpl.php. I know I can modify the template the way I want.

Maybe the way to do it is defining custom variables, such as $block->mycustom.

If the variable is defined there is a link, if not, nothing. The problem with this approach is that I don't know where this variable should be defined.

Is that correct, or am I totally mistaken?

I am interested in an answer for Drupal 7.

1
  • 1
    How is the block created and how would you get the url?
    – googletorp
    Commented Aug 31, 2011 at 20:38

1 Answer 1

1

You could add a theme preprocess function for blocks to add some logic pushing variables into your block template. You can then check against those variables to output the title as a link etc.

THEMENAME_preprocess_block(&$vars) {
 //logic here to add variables
}

Your Answer

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

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