You are here

function adsense_preprocess_block in Google AdSense integration 8

Implements hook_preprocess_block().

File

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

Code

function adsense_preprocess_block(&$variables) {

  // Remove adsense from the block id and classes to bypass adblock rules.
  if ($variables['configuration']['provider'] == 'adsense' && \Drupal::config('adsense.settings')
    ->get('adsense_unblock_ads')) {
    $variables['plugin_id'] = str_replace('adsense', '', $variables['plugin_id']);
    $variables['configuration']['provider'] = '';
  }
}