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

Removed already-deprecated APIs, the removal of which we've been working towards for several years, hence strictly speaking these are not API changes:

  • _drupal_add_css()
  • _drupal_add_js()
  • _drupal_add_library()

Actual API changes (most changes affect <1% of developers, changes applying to at least 5% of developers are in bold):

  • Removed: drupal_sort_css_js() — this was only used internally, and because it was legacy procedural code, strictly speaking, anybody could be calling this. In practice, this is extremely unlikely
  • Removed: drupal_get_css() — less than 1% of contrib modules use this, if even 0.5% — it's only necessary if they want to output the HTML to load CSS manually for a very special use case
  • Removed: drupal_get_js() — same as above, but for JS
  • Changed: drupal_process_attached() — instead of processing/storing the attached assets in a global (which is precisely what we've been working to get rid of for several years), this now only handles non-asset attachments.
  • Added: AttachedAssets(Interface): a value object for tracking the attached assets for a response, as well as the libraries the client has already loaded, if any. This is a value object that AssetResolver's methods accept, and it's how AssetResolver can remain stateless.
  • Added: AssetResolver(Interface): given an AttachedAssets value object, this stateless service can determine which concrete CSS and JS assets should be loaded. Instead of myriads of strange edge cases being encapsulated in _drupal_add_(css|js)() and drupal_get_(css|js)(), this now makes it abundantly clear what is happening. But, not to worry, 99% of developers won't ever to have interact with it; Drupal automatically calls it with the attached assets when rendering responses.
    The methods AssetResolver::getCssAssets() and AssetResolver::getJsAssets()now contain the logic of _drupal_add_css() + drupal_get_css() and _drupal_add_js() + drupal_get_js(), respectively.
    This new class/service reuses the test coverage in AttachedAssetsTest.
  • Added: LibraryDependencyResolver(Interface): given a list of libraries, can expand that list of libraries with their dependencies, but can also calculate the minimal representative subset. This logic used to be implemented in a very convoluted way in _drupal_add_library(), relying on statics to work.
  • Added: AjaxResponse::setAttachments(), to no longer rely on the statics in _drupal_add_(css|js)() to make Ajax responses aware of CSS/JS assets attached in render arrays.
  • Removed: \Drupal\Core\Render\Element\(Scripts|Styles): these were used by drupal_get_(css|js)(), respectively, for rendering the CSS/JS asset collection into HTML. They're now obsolete. Their documentation has been retained; it's been moved to (Css|Js)CollectionRenderer.
  • Changed: drupalSettings.ajaxPageState is only added if it's actually necessary, i.e. if the core/drupal.ajax library is loaded.
  • Added: hook_(css|js|js_settings)_alter() receive an additional parameter now: \Drupal\Core\Asset\AttachedAssetsInterface $assets. This provides extra context, and might be necessary in the decision in what to do in those alter hooks. system_js_settings_alter() uses it to generate the ajaxPageState setting.
Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done