My block has id=block-block-10, now i want to add a more link after the title. This is my code in my theme's template.php.

function mytheme_preprocess_block(&$variables) {
  if($variables['block_id'] == 10){

There is no more text on the block's title. What's wrong with my code?

  • what is the block_id ? 10 or block-block-10 ?
    – nonsenz
    Commented May 21, 2011 at 9:14
  • block-block-10 this is the block html id label.
    – enjoylife
    Commented May 21, 2011 at 9:58
  • Wrong <h2>test> markup? If it's not that.. you can try dsm($variables) with devel and see for yourself what's wrong. (If it's not executing the hook or it's because the if condition produces false)
    – corbacho
    Commented May 21, 2011 at 10:13
  • i'm asking because of your $variables['block_id'] == 10.
    – nonsenz
    Commented May 21, 2011 at 10:42

1 Answer 1


The $variables['block_id'] variable is based on the number of blocks in a region (see template_preprocess_block(). If you want this for a specific block, despite what region it is in, you should be checking $variables['block']->delta == 10 instead.

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.