2

I'm styling a custom region for the "Active Forum Topics Block" that's included with Drupal. can I hide certain elements in region--[name].tpl.php like as it is done in node.tpl.php?

This is part of my node.tpl.php:

    // We hide the elements now so that we can render them later.
    hide($content['comments']);
    hide($content['links']);
    hide($content['field_image']);
    hide($content['links']['#links']['node-readmore']);
    hide($content['links']['#links']['comment-add']);
    hide($content['field_tags']);

I would like to do this if it's possible in region--forum_topics.tpl.php (example name "forum_topics"):

    hide($content['???']);

I don't know what the proper way is, for region.tpl.php. If this is possible, what can I put between brackets to hide the title of the block? If there is a documentation page I can see for more than just the block title, can you please link it?

2 Answers 2

3

It might be easier to do this in the block.tpl.php file (using $block->region to determine the region) as you have the title printed out separately from content there.

In your test environment you can also use stuff like these to get a better overview of complex variables (will help you with issues like this):

drupal_set_message('<pre>'.var_export($content, TRUE).'</pre>');

function print_r_html ($data) {
  ?><pre><?php print_r($data); ?></pre><?php
}
2
  • forgive me for being new to drupal. where would I insert this snippet?
    – hdavis84
    Commented Dec 31, 2011 at 16:59
  • 1
    You can use them directly in your template file. drupal_set_message() may need 2 page loads to show up and is generally better used in functions that do not output anything. The custom print_r_html() function is more suitable for template files.
    – Madis
    Commented Dec 31, 2011 at 17:19
0

You can always use hook_block_view_alter to hide the title, you can do something like this

function MYMODULE_block_view_MODULE_DELTA_alter(&$data, $block) {
  if arg(xx) = xx {  // detemine the path is a forum topic path
    $data['subject'] = xxx;   // change subject
    // or you can:
    unset($data['subject']);
  }
}

ps: MYMODULE is your module name, MODULE_DELTA is block id. Hope it helps.

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.