function HeaderAssetsTestHooks::pageAttachments

Implements hook_page_attachments().

Attributes

#[Hook('page_attachments')]

File

core/modules/system/tests/modules/header_assets_test/src/Hook/HeaderAssetsTestHooks.php, line 17

Class

HeaderAssetsTestHooks
Hook implementations for header_assets_test.

Namespace

Drupal\header_assets_test\Hook

Code

public function pageAttachments(array &$attachments) : void {
  // Attach a header library so that its dependencies, which are not header
  // libraries themselves, are loaded in the header on every page.
  $attachments['#attached']['library'][] = 'header_assets_test/header';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.