Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ContextualHooks.php

function ContextualHooks::pageAttachments

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/src/Hook/ContextualHooks.php, line 63

Class

ContextualHooks
Hook implementations for contextual.

Namespace

Drupal\contextual\Hook

Code

public function pageAttachments(array &$page) : void {
    if (!\Drupal::currentUser()->hasPermission('access contextual links')) {
        return;
    }
    $page['#attached']['library'][] = 'contextual/drupal.contextual-links';
}
RSS feed
Powered by Drupal