jquery_ui.install 1.5 KB

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