You are here

function auto_height_requirements in jQuery Auto Height 7

Same name and namespace in other branches
  1. 8 auto_height.install \auto_height_requirements()
  2. 7.2 auto_height.install \auto_height_requirements()

If the plugin doesn't exist, show a warning on the status report page

File

./auto_height.install, line 10
Install, update and uninstall functions for the 'jQuery Auto Height' module.

Code

function auto_height_requirements($phase) {
  $requirements = array();
  switch ($phase) {
    case 'runtime':
      $path = libraries_get_path('autoheight') . '/jquery.autoheight.js';
      $installed = file_exists($path);
      if (!$installed) {
        $requirements[] = array(
          'title' => t('jQuery AutoHeight plugin'),
          'value' => t('Missing'),
          'description' => t('The jQuery AutoHeight plugin is missing. Download it from !autoheight-url and copy it to !autoheight-library/!autoheight-filename.', array(
            '!autoheight-url' => l(AUTOHEIGHT_PLUGIN_URL, AUTOHEIGHT_PLUGIN_URL, array(
              'external' => TRUE,
            )),
            '!autoheight-library' => libraries_get_path('autoheight'),
            '!autoheight-filename' => AUTOHEIGHT_PLUGIN_FILENAME,
          )),
          'severity' => REQUIREMENT_ERROR,
        );
      }
      else {
        $requirements[] = array(
          'title' => t('jQuery AutoHeight plugin'),
          'value' => t('Installed'),
          'severity' => REQUIREMENT_OK,
        );
      }
      break;
  }
  return $requirements;
}