public static function OldCodeAd::adsenseAdFormats in Google AdSense integration 8
This is the array that holds all ad formats.
All it has is a multi-dimensional array indexed by a key, containing the ad type and the description.
To add a new code:
- Make sure the key is not in use by a different format
- Go to Google AdSense . Get the dimensions . Get the description
Parameters
string $key: Ad key for which the format is needed (optional).
Return value
array if no key is provided: array of supported ad formats as an array (type, description). if a key is provided, the array containing the ad format for that key, or NULL if there is no ad with that key.
Overrides AdsenseAdInterface::adsenseAdFormats
1 call to OldCodeAd::adsenseAdFormats()
- OldCodeAd::getAdContent in oldcode/
src/ Plugin/ AdsenseAd/ OldCodeAd.php - Return the ad content.
File
- oldcode/
src/ Plugin/ AdsenseAd/ OldCodeAd.php, line 136
Class
- OldCodeAd
- Provides an AdSense old code ad unit.
Namespace
Drupal\adsense_oldcode\Plugin\AdsenseAdCode
public static function adsenseAdFormats($key = NULL) {
$ads = [
// Top performing ad sizes.
'300x250' => [
'type' => ADSENSE_OLDCODE_TYPE_AD,
'desc' => t('Medium Rectangle'),
'code' => '300x250_as',
],
'336x280' => [
'type' => ADSENSE_OLDCODE_TYPE_AD,
'desc' => t('Large Rectangle'),
'code' => '336x280_as',
],
'728x90' => [
'type' => ADSENSE_OLDCODE_TYPE_AD,
'desc' => t('Leaderboard'),
'code' => '728x90_as',
],
// Other supported ad sizes.
'468x60' => [
'type' => ADSENSE_OLDCODE_TYPE_AD,
'desc' => t('Banner'),
'code' => '468x60_as',
],
'234x60' => [
'type' => ADSENSE_OLDCODE_TYPE_AD,
'desc' => t('Half Banner'),
'code' => '234x60_as',
],
'120x600' => [
'type' => ADSENSE_OLDCODE_TYPE_AD,
'desc' => t('Skyscraper'),
'code' => '120x600_as',
],
'120x240' => [
'type' => ADSENSE_OLDCODE_TYPE_AD,
'desc' => t('Vertical Banner'),
'code' => '120x240_as',
],
'160x600' => [
'type' => ADSENSE_OLDCODE_TYPE_AD,
'desc' => t('Wide Skyscraper'),
'code' => '160x600_as',
],
'250x250' => [
'type' => ADSENSE_OLDCODE_TYPE_AD,
'desc' => t('Square'),
'code' => '250x250_as',
],
'200x200' => [
'type' => ADSENSE_OLDCODE_TYPE_AD,
'desc' => t('Small Square'),
'code' => '200x200_as',
],
'180x150' => [
'type' => ADSENSE_OLDCODE_TYPE_AD,
'desc' => t('Small Rectangle'),
'code' => '180x150_as',
],
'125x125' => [
'type' => ADSENSE_OLDCODE_TYPE_AD,
'desc' => t('Button'),
'code' => '125x125_as',
],
];
if (!empty($key)) {
return array_key_exists($key, $ads) ? $ads[$key] : NULL;
}
else {
return $ads;
}
}