You are here

function lightbox2_preprocess_page in Lightbox2 8

Same name and namespace in other branches
  1. 6 lightbox2.module \lightbox2_preprocess_page()
  2. 7.2 lightbox2.module \lightbox2_preprocess_page()
  3. 7 lightbox2.module \lightbox2_preprocess_page()

Preprocess function for template by theme('page').

File

./lightbox2.module, line 1448
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_preprocess_page(&$variables) {
  if (arg(0) != 'node' || arg(2) != 'lightbox2') {
    return;
  }

  //Overwrite template_preprocess_page() region settings.
  $theme = \Drupal::theme()
    ->getActiveTheme()
    ->getName();

  // Retrieve all block regions.
  $regions = system_region_list($theme);

  // Remove all region content assigned via blocks.
  foreach (array_keys($regions) as $region) {
    if ($region != 'content') {
      $variables[$region] = NULL;
    }
  }

  // Set up layout variable to none.
  $variables['layout'] = 'none';

  //additional template files for e.g. page-node-lightbox.tpl.php are allready implemented through template_preprocess_page()
}