You are here

function entity_hierarchy_page_attachments in Entity Reference Hierarchy 8

Implements Right now, we're attaching an un-used jS file to all admin pages. Need to re-visit this and only load on the appropriate pages and/or forms.

See also

hook_page_attachments().

File

./entity_hierarchy.module, line 262
A module to make nodes hierarchical.

Code

function entity_hierarchy_page_attachments(&$page) {

  // This returns TRUE for admin paths.
  if (\Drupal::service('router.admin_context')
    ->isAdminRoute()) {

    // Load entity_hierarchy.js on admin pages
    $page['#attached']['library'][] = 'entity_hierarchy/entity_hierarchy.nodetypeform';
  }
}