Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295277

[Meta] Untangle Drupal 8 page rendering

$
0
0

Problem/Motivation

Proposed resolution

Remaining tasks

User interface changes

API changes

During the DrupalCon Amsterdam discussion about page rendering, we decided that the following steps are necessary to fix #2327277: [Meta] Page rendering meta discussion:

Critical

  1. Remove HtmlFragment& HtmlPage, but make sure that '#type' => 'page' works (because controllers should be able to return entire pages, without having the content be surrounded by blocks) — see #2352155: Remove HtmlFragment/HtmlPage
  2. Prevent crazy asset handling and crazy page manipulation:
    1. For the valid use cases of adding content to the page, we introduce hook_page_top() and hook_page_bottom(): for adding content to the very top or bottom of the page (not regions!) — see #2350949: Add hook_page_attachments(_alter)() and deprecate hook_page_build/alter()
    2. Introduce hook_page_attachments(), which may be implemented by both modules and themes, to allow assets to be added to pages conditionally. For assets unconditionally added to pages by themes, hook_preprocess_page() must be used. We keep hook_page_build() around, for backwards compatibility — but we only allow assets to be added — see #2350949: Add hook_page_attachments(_alter)() and deprecate hook_page_build/alter()
  3. Document how to attach assets correctly:
    1. Allow preprocess functions to cleanly attach assets for the associated template — see #2346369: Support special '#attached' variable for attaching assets in preprocess functions
    2. Documentation: hook_page_attachments() to conditionally attach assets to pages, hook_preprocess_page() to unconditionally attach assets to pages — see #2350949: Add hook_page_attachments(_alter)() and deprecate hook_page_build/alter()
  4. Remove drupal_add_html_head(), drupal_add_html_head_link() and drupal_add_feed(), accept ['#attached']['head'], ['#attached']['head_link'], ['#attached']['feed'] instead — see #2350877: Deprecate/rename drupal_add_feed(), drupal_add_html_head(), drupal_add_html_head_link(), drupal_add_http_header(), and allow to be set declaratively in #attached

Nice-to-have


Viewing all articles
Browse latest Browse all 295277

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>