You are here

slick_devel.module in Slick extras 7.3

Same filename and directory in other branches
  1. 8 slick_devel/slick_devel.module
  2. 7.2 slick_devel/slick_devel.module

Provides development options for the Slick module.

File

slick_devel/slick_devel.module
View source
<?php

/**
 * @file
 * Provides development options for the Slick module.
 */
define('SLICK_DEVEL', variable_get('slick_devel', FALSE));
define('SLICK_DEVEL_DEBUG', variable_get('slick_devel_debug', FALSE));
define('SLICK_DEVEL_REPLACE', variable_get('slick_devel_replace', FALSE));
define('SLICK_DEVEL_DISABLE', variable_get('slick_devel_disable', FALSE));

/**
 * Implements hook_menu().
 */
function slick_devel_menu() {
  $items = array();
  $items['admin/config/media/slick/devel'] = array(
    'title' => 'Development',
    'description' => 'Configure the Slick development module settings.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'slick_devel_form_settings',
    ),
    'access arguments' => array(
      'administer slick',
    ),
    'type' => MENU_LOCAL_TASK,
    'weight' => 2,
    'file' => 'includes/slick_devel.admin.inc',
  );
  return $items;
}

/**
 * Implements hook_library_alter().
 */
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']);
    }
  }
}

Functions

Constants

Namesort descending Description
SLICK_DEVEL @file Provides development options for the Slick module.
SLICK_DEVEL_DEBUG
SLICK_DEVEL_DISABLE
SLICK_DEVEL_REPLACE