You are here

function slick_devel_library_alter in Slick extras 7.3

Same name and namespace in other branches
  1. 7.2 slick_devel/slick_devel.module \slick_devel_library_alter()

Implements hook_library_alter().

File

slick_devel/slick_devel.module, line 36
Provides development options for the Slick module.

Code

function slick_devel_library_alter(&$libraries, $module) {
  if ($module != 'slick') {
    return;
  }
  $slick_path = drupal_get_path('module', 'slick');
  $slick_devel = drupal_get_path('module', 'slick_devel');
  $min = $slick_path . '/js/slick.load.min.js';
  $dev = $slick_path . '/js/slick.load.js';
  if (SLICK_DEVEL && isset($libraries['slick'])) {

    // Switch to the un-minified version of the library.
    $libraries['slick']['js'] = array(
      libraries_get_path('slick') . '/slick/slick.js' => array(
        'group' => JS_LIBRARY,
        'weight' => -4,
      ),
    );
  }
  if (isset($libraries['load'])) {
    if (SLICK_DEVEL_DEBUG) {

      // Switch to the non-minified version of the slick.load.min.js.
      $libraries['load']['js'] = array(
        $dev => array(
          'group' => JS_DEFAULT,
          'weight' => 0,
        ),
      );
    }
    if (SLICK_DEVEL_REPLACE && !SLICK_DEVEL_DISABLE) {

      // Switch to slick.load.devel.js.
      $libraries['load']['js'] = array(
        $slick_devel . '/js/slick.load.devel.js' => array(
          'group' => JS_DEFAULT,
          'weight' => 0,
        ),
      );
    }
    elseif (SLICK_DEVEL_DISABLE) {

      // Disable the slick.load.min.js or slick.load.js.
      unset($libraries['load']['js']);
    }
  }
}