You are here

function adsense_adstxt_requirements in Google AdSense integration 8

Same name and namespace in other branches
  1. 7 adstxt/adsense_adstxt.install \adsense_adstxt_requirements()

Implements hook_requirements().

File

adstxt/adsense_adstxt.install, line 11
Install file of the adsense_adstxt module.

Code

function adsense_adstxt_requirements($phase) {
  $requirements = [];
  switch ($phase) {

    // At runtime, make sure there is no existing ads.txt.
    case 'runtime':
      if (file_exists(DRUPAL_ROOT . '/ads.txt')) {
        $requirements['adstxt_file'] = [
          'title' => t('AdSense ads.txt'),
          'value' => t('Existing ads.txt file detected.'),
          'description' => t('This module can only provide an auto-generated version if you remove the existing file. To keep using it, disable this module.'),
          'severity' => REQUIREMENT_WARNING,
        ];
      }
      break;
  }
  return $requirements;
}