I've upgraded from 2.x-dev to 3.9 and Collapsiblock no longer works with blocks generated from Views (e.g. Views Block Displays, Exposed Filters in blocks). All other blocks work fine (e.g. Menu blocks, blocks created manually).

If I replace the block.tpl.php code with a previous one I used (below), it works again.

<?php
?>
  <div class="block block-<?php print $block->module; ?>" id="block-<?php print $block->module; ?>-<?php print $block->delta; ?>">
    <h2 class="title"><?php print $block->subject; ?></h2>
    <div class="content" id="blockcontent"><?php print $block->content; ?></div>
</div>

(NB: I changed the h3 tag to a h2 in both cases to get this to work.)

Comments

jacine’s picture

Status: Active » Closed (won't fix)

I am aware of this, and the h2 tag is what collapsiblock is looking for. In the 2.x branch I caved in and changed this, but I don't believe block titles should be h2 elements, so I changed it back. I ideally the module could ask what tags the theme uses, but since it doesn't you have the option to change the tags yourself if you want to use it. :)

sjf’s picture

Hi Jacine,

Yes, I know about the need to change the tags from h3 to h2 in block.tpl.php. I do this and normal blocks work fine, but still Views-based blocks refuse to collapse/expand. They work fine in other themes. Is there somewhere else in Sky that the tags must be changed?

Regardless, I'm using the above block.tpl.php and all seems fine so this is just a pointer for other users.

jacine’s picture

It shouldn't be any different for view blocks though... Should use the same block.tpl.php.

dpatte’s picture

Hi

I noticed the same thing when installing collapsiblock. It worked for standard blocks but not views blocks. And I'm using the Garland theme (for now)

The problem is resolved if I provide block titles for my views blocks. I was avoiding block titles because the h2 looked too big and instead I was having my views blocks generate headers (which are h3). When I add a block title (h2) to each views block, it then becomes collapsible. Perhaps its the same issue for you.

dpatte’s picture

I have resolved the issue for Garland as follows:
- in block.tml.php I have changed h2 to h3
- in collapsiblock/theme/garland.inc I have changed h2 to h3
- In all views for collapsible blocks I removed the header, and replaced these with a title instead