An analysis of the regions in the current Drupal 7 page.tpl.php is the following:

 header:   in a div#header-region   having a .region class
 content:  in a div#content-area    having a .region class
 left:     in a div.region          (wrapped in a div#sidebar-left)
 right:    in a div.region          (wrapped in a div#sidebar-right) 
 footer:   in a div#footer-region   having a .region class

In an effort to improve consistency, I suggest the following change: whenever there is a .region class, also have an ID which ends in -region (abstracted this rule from the existing header and footer). This calls for doing the following fixes:

  1. Rename 'content-area' to 'content-region'.
  2. Add the #left-region and #right-region IDs to the corresponding inner divs in their wrappers. (No, the regions are not called sidebar-left and sidebar-right, but they are simply called left and right, so the rule formulates this ID).

This rule fixes the above to:

 header:  in a div#header-region   having a .region class
 content: in a div#content-region  having a .region class
 left:    in a div#left-region     having a .region class (wrapped in a #sidebar-left)
 right:   in a div#right-region    having a .region class (wrapped in a #sidebar-right) 
 footer:  in a div#footer-region   having a .region class

Notice the pattern! Much better, no?

The attached patch does this. I think this shows consistency and help theme developers follow simple rules for naming region wrappers. The current scheme makes it impossible to have a consistent style file for the regions, since some of them would need to be selected via their parent elements (left and right) or via their non-region IDs (in case of content-area).

I grepped for 'content-area' in my Drupal 7 checkout and did not find any mention of it outside of the default page.tpl.php.

CommentFileSizeAuthor
region-ids.patch1.62 KBgábor hojtsy

Comments

gábor hojtsy’s picture

Assigned: Unassigned » gábor hojtsy
Status: Active » Needs review
johnalbin’s picture

Status: Needs review » Closed (duplicate)
Issue tags: +tpl-refresh

I completely agree with you.

But content shouldn't be a region, so class="content-area" will make more sense after #378916: Split content region into content_above and content_below gets done (we made it a separate issue from the original page.tpl.php issue to reduce kitten damage.)

Also, the rest of the issue is a dupe of #60552: Add region.tpl.php for all regions in themes