You are here

function adsense_revenue_sharing_basic_requirements in Google AdSense integration 8

Implements hook_requirements().

File

oldcode/revenue_sharing_basic/adsense_revenue_sharing_basic.install, line 11
Install file of the adsense_revenue_sharing_basic module.

Code

function adsense_revenue_sharing_basic_requirements($phase) {
  $requirements = [];
  $t = 't';
  switch ($phase) {

    // At runtime, make sure that we have a publisher ID.
    case 'runtime':
      if (Drupal::moduleHandler()
        ->moduleExists('page_cache') || Drupal::moduleHandler()
        ->moduleExists('dynamic_page_cache')) {
        $requirements['revenue_sharing_nocache'] = [
          'title' => $t('Revenue Sharing'),
          'value' => $t('Drupal page cache is enabled.'),
          'description' => $t('This causes conflicts with revenue sharing, since the pages are stored in the cache and are not dynamically generated. If you experience issues with revenue sharing, then disable the page cache modules.'),
          'severity' => REQUIREMENT_WARNING,
        ];
      }
      break;
  }
  return $requirements;
}