diff --git a/garlic.module b/garlic.module index 01cfce3dc5b40ac51f0a52fc4bf9aeb962005eff..d81b58a1592f27c5119684d50bbd860fa32ec569 100644 --- a/garlic.module +++ b/garlic.module @@ -5,6 +5,8 @@ * Adds the garlic.js library to Drupal and enable basic toggling on entities */ +define(GARLIC_DEBUG, variable_get('garlic_debug', FALSE)); + /** * Implements hook_libraries_info(). */ @@ -61,4 +63,24 @@ function garlic_library() { return $libraries; } + +/** + * Implements hook_library_alter(). + */ +function garlic_library_alter(&$libraries, $module) { + if (GARLIC_DEBUG) { + if ($module == 'garlic' && isset($libraries['garlic'])) { + $libraries['garlic']['js'] = array(libraries_get_path('garlic') . '/garlic.js'); + } + } +} + +/** + * Implements hook_uninstall(). + */ +function garlic_uninstall() { + variable_del('garlic_debug'); +} + + // @todo add hook_requirements \ No newline at end of file