shs.install 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * @file
  4. * Installation tasks for "Simple hierarchical select".
  5. */
  6. /**
  7. * Implements hook_requirements().
  8. */
  9. function shs_requirements($phase) {
  10. $requirements = array();
  11. $t = get_t();
  12. if ($phase !== 'runtime' || !module_exists('chosen')) {
  13. return $requirements;
  14. }
  15. if (($info = drupal_get_library('chosen', 'chosen')) === FALSE) {
  16. return $requirements;
  17. }
  18. // Chosen version should be at least 1.0.
  19. if (version_compare($info['version'], '1.1.0') < 0) {
  20. $requirements['shs'] = array(
  21. 'title' => $t('Simple hierarchical select: chosen integration'),
  22. 'description' => $t('If you would like to use chosen with Simple hierarchical select you need to install at least version 1.1.0 of !chosen_library.', array('!chosen_library' => l($t('Chosen'), 'http://harvesthq.github.io/chosen/'))),
  23. 'severity' => REQUIREMENT_WARNING,
  24. 'value' => $t('Chosen library too old (installed version is !version)', array('!version' => $info['version'])),
  25. );
  26. }
  27. return $requirements;
  28. }