function contextual_page_attachments

contextual_page_attachments(array &$page)

Implements hook_page_attachments().

Adds the drupal.contextual-links library to the page for any user who has the 'access contextual links' permission.

See also

contextual_preprocess()

File

core/modules/contextual/contextual.module, line 63
Adds contextual links to perform actions related to elements on a page.

Code

function contextual_page_attachments(array &$page) {
  if (!\Drupal::currentUser()->hasPermission('access contextual links')) {
    return;
  }

  $page['#attached']['library'][] = 'contextual/drupal.contextual-links';
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!contextual!contextual.module/function/contextual_page_attachments/8.1.x