addfolder
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* The NG Lightbox module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_link_alter().
|
||||
*/
|
||||
function ng_lightbox_link_alter(&$vars) {
|
||||
/** @var \Drupal\ng_lightbox\NgLightbox $lightbox */
|
||||
$lightbox = \Drupal::service('ng_lightbox');
|
||||
if ($lightbox->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';
|
||||
}
|
||||
Reference in New Issue
Block a user