When I add a custom block to the block bar container the title does not show up. The contents does show up though.

Comments

phoenixblue’s picture

add ($output .= $block->title;) in the theme and it'll show

function theme_blockbar_build_panels($panel_title, $panel_id, $blockbar_num, $block){
  // when overriding this theme function care should be taken so as to not break the javascript
  // being called in the onclick event of the title <div>
  
  $output .= '<div class="blockbar-title blockbar-' . $blockbar_num . '-title" onclick="blockbar_toggle(\'' . $panel_id . '\',\'' . $blockbar_num . '\')">';
  $output .= '      <div align="center" class="blockbar-head-img collapse" id="blockbarhead_' . $panel_id . '">';
  $output .= '      </div>';
  $output .= $block->title;
  $output .= '    <div class="blockbar-head blockbar-' . $blockbar_num . '-head" nowrap>' . $panel_title . '</div>';
  $output .= '</div>';
  $output .= '<div class="blockbar-content blockbar-'. $blockbar_num .'-content" id="' . $panel_id . '" style="display:none;">'; 
  $output .= $block->content;
  $output .= '</div>';

  return $output;
}
cappelle’s picture

Thank you very much! The title shows up now.

It created another problem though - the "my favorites" (favorite nodes) block now has TWO titles. Or no title if I try to remove one.

But the custom block is more important to me so I'm glad that is resolved.

phoenixblue’s picture

mmm.. maybe u can do a if (isset($panel_title)) then print $panel_title else print $block->title
heeh.. didn't test it out but yeah..

cappelle’s picture

Whoa! It worked! Thanks again!

I replaced your line of code with this one:

if (!isset($panel_title)) {$output .= $block->title;}

phoenixblue’s picture

ahh.. much better

Sam308’s picture

Category: bug » support

Question for blockbar-4.7.x-1.x-dev:

I looked at the other post "Blockbar title doesn't appear" for Version: 4.7.x-1.x-dev (http://drupal.org/node/47970) for a solution, but this seems to be an old post (February 5, 2006) because line 138 is not an output statement or uncomment out.

In the 5.x-0.1 version you said just add the line:

$output .= $block->title;

to the the theme function and it should work. I am sure it works in version 5.x-0.1 but I tried to get it to work in 4.7.x-1.x-dev by adding this statement to the blockbar.module file from the blockbar-4.7.x-1.x-dev distribution dated Nov 13 2006, but it does not work. I am currently using Drupal 4.7.5.

The current HTML web page output using the unmodified 4.7.x-1.x-dev blockbar.module is shown as below where as the Block title should be between the <H3></H3> tags.

<DIV class="block block-blockbar rightblock" id=block-blockbar-1>
<H3></H3>
<DIV class=content><SPAN class=1 id=block_bar_num>
<DIV class="blockbar-title blockbar-1-title" onclick="blockbar_toggle('_block1_sub1','1')">
<DIV class="blockbar-head-img collapse" id=blockbarhead__block1_sub1 align=center></DIV>
<DIV class="blockbar-head blockbar-1-head" noWrap>Singles Events</DIV></DIV>
<DIV class="blockbar-content blockbar-1-content" id=_block1_sub1 style="DISPLAY: none">
<DIV class=item-list>
<UL>
<LI class=leaf><A href="?q=aggregator/categories/2">Menu Item 1</A> 
<LI class=leaf><A href="?q=aggregator/categories/9">Menu Item 2</A> 
<LI class=leaf><A href="?q=aggregator/categories/15">Menu Item 3</A> 
<LI class=leaf><A href="?q=aggregator/categories/11">Menu Item 4</A> 
<LI class=leaf><A href="?q=aggregator/categories/10">Menu Item 5</A> 
<LI class=leaf><A href="?q=aggregator/categories/7">Menu Item 6</A> 
<LI class=leaf><A href="?q=aggregator/sources/11">Menu Item 7</A>

next section ...

Is there a way to output the Block Title in Version 4.7.x-1.x-dev?

Thanks,

Sam308

dreed47’s picture

Surpressing block titles is done by design but you can easily change it in the module code if you like. In the blockbar_block function in the "view" case there is a line of code commented out (sorry, I didn't look up the line number but it's the only commented out line and should be very easy to find). If you uncomment that line you should have your block titles back.

At some point in the future I should probably make this an option that can be set but I don't have the time right now to do it. (patches welcome :-) )

Sam308’s picture

Thanks, it worked

PixelClever’s picture

Title: Title of custom block does not show up » Title of custom block does not show up: is this going to be patched in future versions?

Are the lines of code presented by Pheonixblue going to be incorporated into the official module release in the future?

dreed47’s picture

Status: Active » Closed (won't fix)