You are here

function shadowbox_page_build in Shadowbox 8

Implements hook_page_build().

File

./shadowbox.module, line 69
Shadowbox, a JavaScript media viewer application for displaying content in a modal dialogue.

Code

function shadowbox_page_build(&$page) {
  $shb_enabled = \Drupal::config('shadowbox.settings')
    ->get('shadowbox_enabled');
  $shb_auto = \Drupal::config('shadowbox.automatic')
    ->get('shadowbox_auto_enable_all_images');
  $shb_enable_globally = \Drupal::config('shadowbox.automatic')
    ->get('shadowbox_enable_globally');

  // Add shadowbox library files.
  if ($shb_enabled && ($shb_auto || $shb_enable_globally) && _shadowbox_activation()) {

    // Add the base files.
    $page['#attached']['library'][] = 'shadowbox/shadowbox';
  }
}