You are here

function footable_requirements in FooTable 7

Same name and namespace in other branches
  1. 8.2 footable.install \footable_requirements()
  2. 7.2 footable.install \footable_requirements()

Implements hook_requirements().

File

./footable.install, line 10
Installation file for FooTable module.

Code

function footable_requirements($phase) {
  $requirements = array();
  $t = get_t();
  $requirements['footable']['title'] = 'FooTable';
  $requirements['footable']['value'] = NULL;
  if (file_exists(dirname(__FILE__) . '/FooTable/js/footable.js')) {
    $requirements['footable']['severity'] = REQUIREMENT_OK;
  }
  elseif (module_exists('libraries') && file_exists(libraries_get_path('FooTable') . '/js/footable.js')) {
    $requirements['footable']['severity'] = REQUIREMENT_OK;
  }
  elseif (!drupal_installation_attempted()) {

    // Required footable library wasn't found; abort installation.
    $requirements['footable']['value'] = $t('Not found');

    // Provide a download link to the FooTable jQuery plugin.
    $requirements['footable']['description'] = $t('The <a href="!footable">FooTable</a> jQuery plugin is missing. See !readme for instructions on how to download and extract it.', array(
      '!footable' => 'http://themergency.com/footable/',
      '!readme' => l(t('README.md'), drupal_get_path('module', 'footable') . "/README.md"),
    ));
    $requirements['footable']['severity'] = REQUIREMENT_ERROR;
  }
  return $requirements;
}