color_field.install 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the Color Fields module.
  5. */
  6. /**
  7. * If the JavaScript Libraries don't exist, show a warning on the status page.
  8. */
  9. function color_field_requirements($phase) {
  10. $requirements = [];
  11. if ($phase === 'runtime') {
  12. if (!file_exists(DRUPAL_ROOT . '/libraries/jquery-simple-color/jquery.simple-color.js')) {
  13. $requirements['color_field_simple'] = [
  14. 'title' => t('Color Field library: jQuery Simple Color'),
  15. 'value' => t('Missing'),
  16. 'description' => t('Download the <a href=":url">jQuery Simple Color library</a> and copy it to :library', [
  17. ':url' => 'https://github.com/recurser/jquery-simple-color',
  18. ':library' => DRUPAL_ROOT . '/libraries/jquery-simple-color/',
  19. ]),
  20. 'severity' => REQUIREMENT_WARNING,
  21. ];
  22. }
  23. else {
  24. $requirements['color_field_simple'] = [
  25. 'title' => t('Color Field library: jQuery Simple Color'),
  26. 'value' => t('Installed'),
  27. 'severity' => REQUIREMENT_OK,
  28. ];
  29. }
  30. if (!file_exists(DRUPAL_ROOT . '/libraries/spectrum/spectrum.js')) {
  31. $requirements['color_field_spectrum'] = [
  32. 'title' => t('Color Field library: Spectrum'),
  33. 'value' => t('Missing'),
  34. 'description' => t('Download the <a href=":url">Spectrum library</a> and copy it to :library', [
  35. ':url' => 'https://github.com/bgrins/spectrum',
  36. ':library' => DRUPAL_ROOT . '/libraries/spectrum/',
  37. ]),
  38. 'severity' => REQUIREMENT_WARNING,
  39. ];
  40. }
  41. else {
  42. $requirements['color_field_spectrum'] = [
  43. 'title' => t('Color Field library: Spectrum'),
  44. 'value' => t('Installed'),
  45. 'severity' => REQUIREMENT_OK,
  46. ];
  47. }
  48. }
  49. return $requirements;
  50. }