You are here

function photoswipe_page_attachments in PhotoSwipe 8.2

Same name and namespace in other branches
  1. 8 photoswipe.module \photoswipe_page_attachments()
  2. 3.x photoswipe.module \photoswipe_page_attachments()

Implements hook_page_attachments().

File

./photoswipe.module, line 68
Photswipe integration with Drupal module.

Code

function photoswipe_page_attachments(array &$attachments) {

  // Conditionally load on non-admin pages.
  $is_admin = \Drupal::service('router.admin_context')
    ->isAdminRoute();
  if (\Drupal::config('photoswipe.settings')
    ->get('photoswipe_always_load_non_admin') && !$is_admin) {
    \Drupal::service('photoswipe.assets_manager')
      ->attach($attachments);
  }
}