You are here

function sticky_page_attachments in Sticky 2.0.x

Same name and namespace in other branches
  1. 8 sticky.module \sticky_page_attachments()

Implements hook_page_attachments().

File

./sticky.module, line 26
Contains sticky.module..

Code

function sticky_page_attachments(array &$attachments) {

  /** @var \Drupal\sticky\Manager\StickyManager $manager */
  $manager = Drupal::service('sticky.manager');

  // Pass the sticky settings.
  $attachments['#attached']['drupalSettings']['sticky'] = $manager
    ->getJsSettings();

  // Load the sticky js library.
  $attachments['#attached']['library'][] = 'sticky/sticky';
}