1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * Installation file for jQuery UI module. |
---|
6 | */ |
---|
7 | |
---|
8 | /** |
---|
9 | * Implementation of hook_requirements(). |
---|
10 | */ |
---|
11 | function jquery_ui_requirements($phase) { |
---|
12 | $requirements = array(); |
---|
13 | $t = get_t(); |
---|
14 | $jquery_ui_version = 0; |
---|
15 | |
---|
16 | if ($phase == 'install') { |
---|
17 | // The jquery_ui_get_version() function is in the .module file, which isn't |
---|
18 | // loaded yet. |
---|
19 | include_once dirname(__FILE__) . '/jquery_ui.module'; |
---|
20 | } |
---|
21 | |
---|
22 | $requirements['jquery_ui']['title'] = $t('jQuery UI'); |
---|
23 | if ($jquery_ui_version = jquery_ui_get_version()) { |
---|
24 | // Everything looks good; display the current jQuery UI version. |
---|
25 | $requirements['jquery_ui']['value'] = $jquery_ui_version; |
---|
26 | $requirements['jquery_ui']['severity'] = REQUIREMENT_OK; |
---|
27 | } |
---|
28 | else { |
---|
29 | // Required library wasn't found. Abort installation. |
---|
30 | $requirements['jquery_ui']['value'] = $t('Not found'); |
---|
31 | // Provide a download link to the jQuery UI development bundle. The provided |
---|
32 | // link will list the latest 1.6.x build. |
---|
33 | $requirements['jquery_ui']['description'] = $t('The <a href="@jqueryui">jQuery UI</a> plugin is missing. <a href="@download">Download</a> and extract it into the <code>@directory</code> directory. Rename the extracted folder to <code>@library-folder</code>.', array( |
---|
34 | '@jqueryui' => 'http://jqueryui.com', |
---|
35 | '@download' => 'http://code.google.com/p/jquery-ui/downloads/list?q=1.6', |
---|
36 | '@directory' => 'sites/all/libraries', |
---|
37 | '@library-folder' => 'jquery.ui', |
---|
38 | )); |
---|
39 | $requirements['jquery_ui']['severity'] = REQUIREMENT_ERROR; |
---|
40 | } |
---|
41 | |
---|
42 | return $requirements; |
---|
43 | } |
---|
44 | |
---|
45 | /** |
---|
46 | * Implementation of hook_uninstall(). |
---|
47 | */ |
---|
48 | function jquery_ui_uninstall() { |
---|
49 | variable_del('jquery_ui_compression_type'); |
---|
50 | } |
---|
51 | |
---|