Change record status: 
Project: 
Introduced in branch: 
8.0.x
Introduced in version: 
8.0.0-beta3
Description: 

In Drupal 7 and in Drupal 8 before this change, it was possible for any module to make dynamic page alterations, thereby implicitly allowing arbitrary dynamic page alterations and easily breaking cacheability.

There are only two valid use case of dynamically adding things to the final page:

  1. assets that aren't associated with a specific bit of content, but with the entire page (think in-place editing)
  2. adding things to the special page_top and page_bottom "regions", which is used by e.g. Toolbar and the Block demonstration page

Before

You could change $page['content'] (or, generally speaking, $page[$region_name]) into something completely different.

Available hooks:

  1. hook_page_build()
  2. hook_page_alter()

After

You no longer can change $page['content'] (or, generally speaking, $page[$region_name]) into something completely different.

Available hooks:

  1. hook_page_attachments()
  2. hook_page_attachments_alter()
  3. hook_page_top()
  4. hook_page_bottom()
Impacts: 
Module developers
Themers