Newer
Older
<?php
/**
* @file
* Adds the garlic.js library to Drupal and enable basic toggling on entities
*/
define(GARLIC_DEBUG, variable_get('garlic_debug', FALSE));
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* Implements hook_libraries_info().
*/
function garlic_libraries_info() {
// Garlic
$libraries['garlic'] = array(
'name' => "Garlic.js",
'vendor url' => 'http://garlicjs.org/',
'download url' => 'http://garlicjs.org/',
'path' => 'garlic',
'version arguments' => array(
'file' => 'dist/garlic.min.js',
'pattern' => '/(\d+\.\d+\.\d+)/',
'lines' => 1,
),
'files' => array(
'js' => array(
'dist/garlic.min.js'
)
),
'variants' => array(
'minified' => array(
'files' => array(
'js' => array(
'dist/garlic.min.js'
),
),
),
'source' => array(
'files' => array(
'js' => array(
'garlic.js'
),
),
),
),
);
return $libraries;
}
Mathew Winstone
committed
/**
* Implements hook_library().
*/
function garlic_library() {
// Garlic
$libraries['garlic'] = array(
'title' => 'Garlic',
'website' => 'http://garlicjs.org',
'version' => '1.2.0',
'js' => array(
libraries_get_path('garlic') . '/dist/garlic.min.js' => array(),
Mathew Winstone
committed
),
);
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');
}