You are here

function googleanalytics_requirements in Google Analytics 7

Same name and namespace in other branches
  1. 5 googleanalytics.module \googleanalytics_requirements()
  2. 6.4 googleanalytics.install \googleanalytics_requirements()
  3. 6 googleanalytics.module \googleanalytics_requirements()
  4. 6.2 googleanalytics.install \googleanalytics_requirements()
  5. 6.3 googleanalytics.install \googleanalytics_requirements()
  6. 7.2 googleanalytics.install \googleanalytics_requirements()

Implements hook_requirements().

File

./googleanalytics.install, line 71
Installation file for Google Analytics module.

Code

function googleanalytics_requirements($phase) {
  $requirements = array();
  $t = get_t();
  if ($phase == 'runtime') {

    // Raise warning if Google user account has not been set yet.
    if (!preg_match('/^UA-\\d{4,}-\\d+$/', variable_get('googleanalytics_account', 'UA-'))) {
      $requirements['googleanalytics'] = array(
        'title' => $t('Google Analytics module'),
        'description' => $t('Google Analytics module has not been configured yet. Please configure its settings from the <a href="@url">Google Analytics settings page</a>.', array(
          '@url' => url('admin/config/system/googleanalytics'),
        )),
        'severity' => REQUIREMENT_WARNING,
        'value' => $t('Not configured'),
      );
    }
  }
  return $requirements;
}