public function ManagedAdBlock::createAd in Google AdSense integration 8
Create ad object.
Return value
AdsenseAdBase The created ad.
Overrides AdBlockInterface::createAd
File
- src/
Plugin/ Block/ ManagedAdBlock.php, line 81
Class
- ManagedAdBlock
- Provides an AdSense managed ad block.
Namespace
Drupal\adsense\Plugin\BlockCode
public function createAd() {
$format = $this->configuration['ad_format'];
if ($format == 'custom') {
$format = $this->configuration['ad_width'] . 'x' . $this->configuration['ad_height'];
}
return new ManagedAd([
'format' => $format,
'slot' => $this->configuration['ad_slot'],
'shape' => $this->configuration['ad_shape'],
'layout_key' => $this->configuration['ad_layout_key'],
]);
}