public static function AdsenseAdBase::isDisabled in Google AdSense integration 8
Check if ads display is disabled.
Parameters
string $text: Reason for the ad display being disabled.
Return value
bool TRUE if ads are disabled.
2 calls to AdsenseAdBase::isDisabled()
- AdsenseAdBase::display in src/
AdsenseAdBase.php - Display ad HTML.
- adsense_page_attachments in ./
adsense.module - Implements hook_page_attachments().
File
- src/
AdsenseAdBase.php, line 176
Class
- AdsenseAdBase
- Base class for the AdsenseAd plugins.
Namespace
Drupal\adsenseCode
public static function isDisabled(&$text = '') {
$account = \Drupal::currentUser();
$config = \Drupal::config('adsense.settings');
if (!$config
->get('adsense_basic_id')) {
$text = 'no publisher id configured.';
}
elseif ($config
->get('adsense_disable')) {
$text = 'adsense disabled.';
}
elseif ($account
->id() != 1 && $account
->hasPermission('hide adsense')) {
$text = 'disabled for current user.';
}
else {
return FALSE;
}
return TRUE;
}