Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi, I really appreciate your theme and support!
I just upgraded from 7x-2.3 to 7x-3.1 and noticed that blocks in the Main Content region no longer have the <div class="block-inner">
wrapper.
I think I need to override block.tpl.php, but I'm not sure exactly what code to put in there that will add the wrapper back in for Main Content blocks while keeping everything else the same. Does anyone have a suggestion?
Comments
Comment #1
nesta_ CreditAttribution: nesta_ commentedYou use a subtheme? or a at_core?
Comment #2
mollybt CreditAttribution: mollybt commentedHi, I am using a subtheme....copied block.tpl.php from at_core to my subtheme.
Comment #3
nesta_ CreditAttribution: nesta_ commentedYou code is not: ???
Comment #4
mollybt CreditAttribution: mollybt commentedNo, not for blocks in the main content area. For example you can see here:
http://housing.drupaldev.oist.ucsb.edu/future-residents
There is no
<div class="block-inner clearfix">
, onlyI believe that is by design, from reading the documentation in block.tpl.php :
"* - $content_processed: Pre-wrapped in div and attributes, but for some
* blocks these are stripped away, e.g. menu bar and main content."
Comment #5
Jeff Burnz CreditAttribution: Jeff Burnz commentedIts by design, I will try to explain briefly without getting into a major discussion (easily done on this point...).
Long story short - Drupal can output almost anything via the "main content" region - could be a block, a panel or other view e.g. taxonomy terms. Remember, Drupal 7 can run with the block module switched off and output almost anything you want, while that sounds good to be frank unless you are using Panels then not using block module is not really an option in this theme, nor any theme for that matter.
This makes its incredibly problematic to hinge critical layout on markup that might not be there, such as block markup. Almost everywhere else in the theme block-inner has margin to create the gutters, however for the main content we add that margin to the #main-content wrapper div - I am forced to do this because of the aforementioned issues with relying on block markup.
This is why the block-inner div is removed from the main content block. I could just remove the class, but I decided to remove the whole div.
Remember you can always add markup back in, either by creating a block template or in your theme block process function.
Comment #6
mollybt CreditAttribution: mollybt commentedThanks for the explanation Jeff, it makes sense.
Comment #7.0
(not verified) CreditAttribution: commentedadded code tag
Comment #8
demonde CreditAttribution: demonde commentedHow can I manually get back the block-inner in the main region in the theme code? Is there a way to achive this with submodule function in template.php?