Regions in themes

As of version 4.7, Drupal theme authors can define and implement any number of 'regions' for content to be rendered into. This regioning system replaces the previous 'left' and 'right' sidebar regions and should enable much more flexible layout and design.

For themes not based on theme engines, available regions are defined in a themename_regions() function in the .theme file. Engine-based themes have their engine's regions (defined in a .engine file) and may also implement their own regions.

Content is assigned to regions through the block system and also through drupal_set_content() calls. For example, drupal_set_content('left', 'Hello there.') would assign the text 'Hello there.' to the left region (usually implemented as a left sidebar). Any regions defined in the current theme or its theme engine are available on the block configuration page.

The first region defined in a theme's .theme file (or a theme's engine's .engine file) becomes that theme's 'default' region, used for example as the default option for block placement in the block configuration pages.

See the page on upgrading 4.6 themes for minimal upgrade requirements; see the plain PHP theme and PHPTemplate pages for details on how to implement regions.

 
 

Drupal is a registered trademark of Dries Buytaert.