You are here

function timeago_requirements in Timeago 6.2

Same name and namespace in other branches
  1. 7.2 timeago.install \timeago_requirements()

Implementation of hook_requirements().

File

./timeago.install, line 11
(Un)installs the Timeago module.

Code

function timeago_requirements($phase) {
  $t = get_t();
  $requirements = array(
    'timeago' => array(
      'title' => $t('Time ago library'),
      'value' => '0.9.3',
    ),
  );
  $exists = file_exists(drupal_get_path('module', 'timeago') . '/jquery.timeago.js');
  if ($exists) {
    $requirements['timeago']['description'] = $t('Library exists.');
    $requirements['timeago']['severity'] = REQUIREMENT_OK;
  }
  else {
    $requirements['timeago']['description'] = $t('Library does not exist. <a href="http://timeago.yarp.com/jquery.timeago.js">Download the library</a> and put it in the timeago module folder.');
    $requirements['timeago']['severity'] = $phase == 'runtime' ? REQUIREMENT_ERROR : REQUIREMENT_WARNING;
  }
  return $requirements;
}