You are here

function date_api_requirements in Date 7.2

Same name and namespace in other branches
  1. 5.2 date_api.install \date_api_requirements()
  2. 6.2 date_api.install \date_api_requirements()
  3. 6 date_api.install \date_api_requirements()
  4. 7.3 date_api/date_api.install \date_api_requirements()

Implements hook_requirements().

File

date_api/date_api.install, line 31
Install, update and uninstall functions for the date_api module.

Code

function date_api_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {
    $t = get_t();
    module_load_include('module', 'date_api');
    $messages = date_api_status();
    $error_messages = !empty($messages['errors']) ? $messages['errors'] : array();
    $success_messages = !empty($messages['success']) ? $messages['success'] : array();
    if (!empty($error_messages)) {
      $requirements['date'] = array(
        'title' => $t('Date API'),
        'value' => $t('Missing system date settings'),
        'description' => implode(' ', array_merge($error_messages, $success_messages)),
        'severity' => REQUIREMENT_ERROR,
      );
    }
    else {
      $requirements['date'] = array(
        'title' => $t('Date API'),
        'value' => $t('System date settings'),
        'description' => implode(' ', $success_messages),
      );
    }
  }
  return $requirements;
}