You are here

function lightbox2_add_files in Lightbox2 5

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

Provides a link to the CSS stylesheet associated with this module. Provides a link to the JS file associated with this module.

2 calls to lightbox2_add_files()
lightbox2_field_formatter in ./lightbox2.module
Implementation of hook_field_formatter().
lightbox2_nodeapi in ./lightbox2.module
Implementation of hook_nodeapi().

File

./lightbox2.module, line 208

Code

function lightbox2_add_files() {

  // Load required js and css files.
  $path = drupal_get_path('module', 'lightbox2');

  // Check to see if Lightbox2 Plus is enabled.
  if (variable_get('lightbox2_plus', true)) {
    if (function_exists('drupal_add_css')) {
      drupal_add_css($path . '/lightbox.css');
    }
    else {
      theme('add_style', $path . '/lightbox.css');
    }

    // Check to see if Libraries are installed correctly.
    if (file_exists($path . '/js/prototype.js')) {
      drupal_add_js($path . '/js/prototype.js');

      // Check to see if the Image Node Option is enabled in settings.
      if (variable_get('lightbox2_image_node', true)) {
        if (variable_get('lightbox2_image_group', true)) {
          if (variable_get('lightbox2_disable_nested_galleries', true)) {
            drupal_add_js($path . '/js/image_nodes_galleries.js');
          }
          else {
            drupal_add_js($path . '/js/image_nodes.js');
          }
        }
        else {
          if (variable_get('lightbox2_disable_nested_galleries', true)) {
            drupal_add_js($path . '/js/image_nodes_nogroup_galleries.js');
          }
          else {
            drupal_add_js($path . '/js/image_nodes_nogroup.js');
          }
        }
      }
      drupal_add_js($path . '/js/scriptaculous.js?load=effects');
      drupal_add_js($path . '/js/lightbox.js');

      // Future support for non-images will go here.

      //drupal_add_js($path .'/js/lightbox_docs.js');
    }
    else {
      drupal_set_message(t('The script.aculo.us library is in not installed correctly. Please download from <a href="http://www.stellapowerdesign.net/scriptaculous.zip">http://www.stellapowerdesign.net/scriptaculous-drupal.zip</a>, follow the instructions in the Lightbox V.2 README.TXT file to copy the files to their correct locations.'), 'error');
    }
  }
  else {
    if (function_exists('drupal_add_css')) {
      drupal_add_css($path . '/lightbox_lite.css');
    }
    else {
      theme('add_style', $path . '/lightbox_lite.css');
    }
    drupal_add_js($path . '/js/lightbox_lite.js');
  }
  drupal_add_js($path . '/js/lightningload.js');
}