auto_height.install in jQuery Auto Height 8
Same filename and directory in other branches
Install, update, and uninstall functions for the jQuery Auto Height module.
File
auto_height.installView source
<?php
/**
 * @file
 * Install, update, and uninstall functions for the jQuery Auto Height module.
 */
/**
 * Implements hook_requirements().
 */
function auto_height_requirements($phase) {
  $requirements = array();
  // Check if plugin exists
  if ($phase == 'install') {
    $path = DRUPAL_ROOT . '/libraries/autoheight/jquery.autoheight.js';
    $installed = file_exists($path);
    if (!$installed) {
      // display a warning message..
      drupal_set_message(t('The jQuery AutoHeight plugin is missing. <a href="https://raw.githubusercontent.com/monocult/jquery-autoheight/master/jquery.autoheight.js" rel="external">Download the plugin</a> and place it in /libraries/autoheight/jquery.autoheight.js'), 'warning');
    }
  }
  else {
    if ($phase == 'runtime') {
      $path = DRUPAL_ROOT . '/libraries/autoheight/jquery.autoheight.js';
      $installed = file_exists($path);
      if (!$installed) {
        $requirements['auto_height'] = array(
          'title' => t('jQuery AutoHeight plugin'),
          'value' => t('Missing'),
          'description' => t('<a href=":url" rel="external">Download the plugin</a> and place it in :library', array(
            ':url' => AUTOHEIGHT_PLUGIN_URL,
            ':library' => AUTOHEIGHT_LIBRARY_PATH,
          )),
          'severity' => REQUIREMENT_WARNING,
        );
      }
      else {
        $requirements['auto_height'] = array(
          'title' => t('jQuery AutoHeight plugin'),
          'value' => t('Installed'),
          'severity' => REQUIREMENT_OK,
        );
      }
    }
  }
  return $requirements;
}Functions
| Name   | Description | 
|---|---|
| auto_height_requirements | Implements hook_requirements(). | 
