You are here

function google_analytics_reports_api_requirements in Google Analytics Reports 7.3

Same name and namespace in other branches
  1. 8.3 google_analytics_reports_api/google_analytics_reports_api.install \google_analytics_reports_api_requirements()

Implements hook_requirements().

File

google_analytics_reports_api/google_analytics_reports_api.install, line 64
Installation file for Google Analytics Reports API module.

Code

function google_analytics_reports_api_requirements($phase) {
  $requirements = array();

  // Ensure translations don't break during installation.
  $t = get_t();

  // Report Google Analytics Reports API authorization status.
  if ($phase == 'runtime') {
    $access = variable_get('google_analytics_reports_api_access_token', NULL);
    $value = $access ? $t('You have successfully authorized.') : $t('You must <a href="@url">authorize</a> Drupal to use your Google Analytics account before you can view reports.', array(
      '@url' => url('admin/config/system/google-analytics-reports-api'),
    ));
    $severity = $access ? REQUIREMENT_OK : REQUIREMENT_ERROR;
    $requirements['google_analytics_reports_api_authorization'] = array(
      'title' => $t('Google Analytics Reports API authorization'),
      'value' => $value,
      'severity' => $severity,
    );
  }
  return $requirements;
}