isNgLightboxEnabledPath($vars['url'])) { $lightbox->addLightbox($vars); } elseif (!empty($vars['options']['attributes']['class'])) { // We have to normalize to an array because many places incorrectly set // class to a string. $vars['options']['attributes']['class'] = (array) $vars['options']['attributes']['class']; if (in_array('ng-lightbox', $vars['options']['attributes']['class'])) { $lightbox->addLightbox($vars); } } // If you've enabled/disabled the modal for admin paths this allows you to // override it for one off paths. \Drupal::moduleHandler()->alter('ng_lightbox_ajax_path', $vars); } /** * Implements hook_page_attachments(). */ function ng_lightbox_page_attachments(array &$attachments) { $attachments['#attached']['library'][] = 'ng_lightbox/ng_lightbox'; }