You are here

function lightbox2_exclude_these_paths in Lightbox2 8

Same name and namespace in other branches
  1. 5.2 lightbox2.module \lightbox2_exclude_these_paths()
  2. 5 lightbox2.module \lightbox2_exclude_these_paths()
  3. 6 lightbox2.module \lightbox2_exclude_these_paths()
  4. 7.2 lightbox2.module \lightbox2_exclude_these_paths()
  5. 7 lightbox2.module \lightbox2_exclude_these_paths()

Return TRUE if current path is disabled for lightbox according to lightbox2_page_list and lightbox2_page_init_action.

2 calls to lightbox2_exclude_these_paths()
InitSubscriber::onEvent in src/EventSubscriber/InitSubscriber.php
lightbox2_init in ./lightbox2.module
Implementation of hook_init().

File

./lightbox2.module, line 1429
Enables the use of lightbox2 which places images above your current page, not within. This frees you from the constraints of the layout, particularly column widths.

Code

function lightbox2_exclude_these_paths() {
  $action = \Drupal::config('lightbox2.settings')
    ->get('lightbox2_page_init_action');
  $page_list = \Drupal::config('lightbox2.settings')
    ->get('lightbox2_page_list');
  if (!empty($page_list)) {

    // Retrieve Drupal alias for the current path (if exists).
    $alias = drupal_get_path_alias($_GET['q']);
    if (drupal_match_path($_GET['q'], $page_list) || drupal_match_path($alias, $page_list)) {
      return $action == 'page_disable' ? 1 : 0;
    }
  }
  return $action == 'page_disable' ? 0 : 1;
}