You are here

public function CustomSearchAdBlock::createAd in Google AdSense integration 8

Create ad object.

Return value

AdsenseAdBase The created ad.

Overrides AdBlockInterface::createAd

File

src/Plugin/Block/CustomSearchAdBlock.php, line 77

Class

CustomSearchAdBlock
Provides an AdSense Custom Search ad block.

Namespace

Drupal\adsense\Plugin\Block

Code

public function createAd() {
  $configuration = [
    'slot' => $this->configuration['ad_slot'],
  ];
  switch ($this->configuration['version']) {
    case '1':
      return new CustomSearchAd($configuration);
    case '2':
    default:
      return new CustomSearchV2Ad($configuration);
  }
}