Block module changes

  • Block module is no longer responsible for page layouts, and as such most of its administration pages have been removed, including configuring blocks (other than custom block content), node type conditionals, path-based display, and role-based display. These are replaced by Layout block conditions (supporting these options and more, such as language conditions).
  • Block module's tables for block, block_role, and block_node_type no longer exist.
  • hook_block_view() now receives two additional arguments for $settings and $contexts, allowing per-block configuration and different contexts per block (no more node_load(arg(1)))
  • hook_block_info() may now specify "required contexts" as an array.
  • hook_block_save() now takes the $edit parameter by reference. Settings no longer have to be saved manually into variables. The contents of the $edit array will be saved into the layout configuration.
  • block_custom_block_get() is now block_custom_block_load() to allow for menu loading.

$page variable has been removed

The $page renderable is gone, as are hook_page_build() and hook_page_alter(). There are no full replacements for these hooks, as the page is now built by layouts. There is no longer the ability to manually move a block from one location on the page to another via hook, but the flexibility of Layouts makes this unnecessary. In the land of Layouts, you would simply add a new layout that had the blocks in the right place. Modules currently using hook_page_build/alter() usually did so to add JS or footers to the page, which can be done via hook_preprocess_page().
See the example in Admin Menu

As the $page renderable no longer exists, we need a new way to disable messages during BatchAPI. Previously, this was done by setting $page['#show_messages'] = FALSE. Now we have a replacement function backdrop_show_messages(FALSE) that will hide (or show) messages for a page request.

backdrop_set_page_content() removed

Backdrop/drupal_set_page_content() no longer exists, which added blocks to a region. Although not encouraged, this may be done with hook_preprocess_layout() to add blocks to a region outside the normal Layout flow.

Menu access callbacks

Menu access callbacks may now be in separate .inc files instead of in the main module.

Support for "base hooks"

Support for "base hooks" in the theme now call the preprocess functions of the base hooks. e.g. System module specifies the template "block--system--main.tpl.php", which is a suggestion of the Layout module "block.tpl.php". Previously, template_preprocess_block() would not be called for this suggestion. Now, template_preprocess_block() is called, followed by the suggestion of template_preprocess_block__system__main() (if it existed).

html.tpl.php removed

The html.tpl.php file is now page.tpl.php (again, similar to D6). The old page.tpl.php file is replaced by individual layout.tpl.php files.

Body classes are no longer added based on sidebars

Body classes are not longer added based on sidebars (e.g. .no-sidebars, .sidebar-first, .two-sidebars, etc.)

No automatic path-based suggestions for page templates

Page templates no longer have automatic path-based suggestions (e.g. page--node-1.tpl.php). Instead create separate layouts or if needed, recreate the suggestion via hook_preprocess_page().

New header.tpl.php file

A new header.tpl.php file is introduced, that is used for the header blocks, including the logo, site name, and an optional menu (by default it is the User Menu).

Page variable changes

Variables previously in page.tpl.php have been moved around:
Introduce into layout.tpl.php:

  • $classes
  • $attributes

Moved to layout.tpl.php:

  • $messages
  • $title
  • $title_prefix
  • $title_suffix
  • $tabs
  • $content (contains all regions)

Removed entirely:

  • $action_links
  • $node
  • $is_admin

Added to everything

  • $base_path
  • $directory

Now part of header block:

  • $logo
  • $front_page
  • $is_front
  • $logged_in
  • $site_name
  • $site_slogan
  • $hide_site_name
  • $hide_site_slogan
  • $primary_menu (renamed to $menu)

Move to separate blocks:

  • $breadcrumb (new block)
  • $feed_icons (use the node syndicate block)
  • $secondary_menu (place as a normal menu block)

Changes in menu_local_actions() and menu_local_actions()

menu_local_actions() and menu_local_actions() now returned a string of rendered HTML instead of a renderable array.

Introduced in branch: 
Introduced in version: 
Architects, Administrators, Editors
Module developers
Theme developers