Make Regions Collapsible
danreb opened this issue · 1 comments
The default behavior of drupal themes block regions is to collapse if there were no contents or there were no blocks assigned in the regions. Current implementation in BBB theme doesn't behave like this. For a quick fix we can easily use ternary operator to make the content region check if there were contents in sidebar and adjust the span size as necessary like this:
<article class="span<?php print ($page['sidebar']) ? '9' : '12'; ?>" id="main-content" role="article">
With this in place, If there were no content in sidebar, the content area will consume the full width available and revert to its default width if there were blocks assigned in sidebar
This quick fix is good for now because BBB have few regions but in case the user already inserted several regions, I think creating a custom function to handle this is the best way.
Hmm, conditional classes, I've thought about adding that. I didn't know if I was the only one that would need that, but if others think it's a worthy edition, I'll throw it in there! I end up doing it on most sites I build.