You are here

function adsense_requirements in Google AdSense integration 6

Same name and namespace in other branches
  1. 8 adsense.install \adsense_requirements()
  2. 5.3 adsense.module \adsense_requirements()
  3. 7 adsense.install \adsense_requirements()

Implementation of hook_requirements().

File

./adsense.module, line 168
Displays Google AdSense ads on Drupal pages.

Code

function adsense_requirements($phase) {
  $requirements = array();
  $t = get_t();
  switch ($phase) {

    // At runtime, make sure that we have a publisher ID.
    case 'runtime':
      $basic_id = variable_get('adsense_basic_id', ADSENSE_BASIC_ID_DEFAULT);
      if (empty($basic_id)) {
        $requirements['adsense_basic_id'] = array(
          'title' => $t('AdSense'),
          'value' => $t('Publisher ID is not set.'),
          'description' => $t('Please configure it in the <a href="@url">AdSense Publisher ID settings page</a>.', array(
            '@url' => url('admin/settings/adsense/publisher'),
          )),
          'severity' => REQUIREMENT_ERROR,
        );
      }
      break;
  }
  return $requirements;
}