In order for Collapsiblock to work, the block content must be wrapped by a "content" class. http://drupal.org/node/472266

In short, block.tpl.php must contain something like the following.

<div<?php print $block_module_delta ? ' id="'. $block_module_delta .'"' : ''; ?> class="<?php print $classes; ?>">
  <div class="block-inner">

    <?php if ($block->subject): ?>
      <h2 class="block-title title"><?php print $block->subject; ?></h2>
    <?php endif; ?>

    <div class="content"><?php print $block->content ?></div>

    <?php print $edit_links; ?>

  </div>
</div> <!-- /block -->

Changing this in the basetheme would add Collapsiblock support out of the box. It would also be acceptable to override this at the subtheme level, in which case instructions should be added regarding additional steps required for Collapsiblock support.

Comments

Jeff Burnz’s picture

Status: Active » Closed (won't fix)

I think its pretty easy to add your own markup and classes if you want to use this module or others that rely on certain markup (Feedback module is another one) - I'd rather keep the theme clean and allow themers to add/remove what they want.

9 times out of 10 I don't need that extra wrapper DIV so I'd rather not have it by default.

Just to be clear, I am well aware of the requirements of these modules and its a deliberate design decision to not support them out of the box - for the sake of clean code ;)

Cybergarou’s picture

I figured this was your reasoning for not having that wrapper, and if the purpose of that wrapper was simply to aid in theme development I would agree. That's not the case here though. That wrapper provides programming functionality to Drupal which is why it's in the core themes.

I already said it would be ok to require that anyone who wants to use modules like this overrides the template in their subtheme, I'm already doing this. The problem is you really do need to tell them that they need to do that. I was able to figure it out, but only after searching the site, finding the page I linked to, and realizing that Genesis was related to Adaptivetheme.

Here's an analogy to show where I'm coming from. I can remove all heading tags for the sake of making my code cleaner. Mostly I only use them at the top of the page after all. However, if I don't tell the visitors to my site that they need to edit the source and put h3 tags around the first line, then they will be left wondering why it's so hard to discern the title of my articles from the body.

This is a non-issue for me and I'm very happy with all the work you have put into Adaptivetheme. I'm only disagreeing here for the sake of other people who decide to use this theme and also have one of these modules.

Jeff Burnz’s picture

Well perhaps removing all heading elements is not the best example because that would make the document worse not better; headings are crucial to the documents structure but here we are talking about the addition of a wrapper for adding behavior.

That is really the crucial argument here - AT doesn't care so much about style or behavior, what it cares about is structure and semantics. The themer can add both style and behavior to their subtheme (as you point out) *if they need it*. Its much harder to build correct structure and semantics into Drupal documents because so much logic is required and that means PHP and this is where many designers and themers get stuck.

I'm happy to document this and will probably throw in a few more examples of adding markup for behavior and other purposes.

Cybergarou’s picture

There's a key difference. Where you see this wrapper as adding behavior through Collapsiblock, I see it as adding both behavior and structure. Without Collapsiblock, I can only get about 2 blocks on screen. With it, I can get 5-6 and everything can still be seen on screen without scrolling. The behavior is only the means by which I get my structure. I gave the example I did because in my mind they are serving the same purpose.

With the given reasons I'm a little confused why the title wrapper is still present when the content wrapper was removed. I'm guessing it falls under semantics? It isn't really needed as a selector because the h2 tag alone can serve the same purpose.

If you still prefer to put this in documentation I'm willing to help out. I could write something up next week, just let me know where and if you want it.

Jeff Burnz’s picture

Hmmm, well heres to skinny dude - "structure" refers to the structure of the document, what you are calling structure is in fact layout, these are quite different things - HTML is a structural language and this has nothing to do with layout but rather the semantic structure of a document.

There is no title wrapper, but rather two classes on the h2 and the reason is very simple:

.article-title - used to target ONLY article titles, no matter how nested
.title - used to target ALL titles, no matter what template

This pseudo CSS name-spacing is necessary to offer better support for browsers that do not support the child selector (>), which now days is only IE6. The H2 can do everything we want if you want to write very long selectors, but I prefer succinct selectors and these are important when you are working on very large projects and many themers and designers need to grok the CSS quickly.

Cybergarou’s picture

That's what I needed to hear, thanks for taking the time to explain.