You are here

public function CustomSearchV2Ad::getAdContent in Google AdSense integration 8

Return the ad content.

Return value

array ad content

Overrides AdsenseAdInterface::getAdContent

File

src/Plugin/AdsenseAd/CustomSearchV2Ad.php, line 56

Class

CustomSearchV2Ad
Provides an AdSense custom search engine form.

Namespace

Drupal\adsense\Plugin\AdsenseAd

Code

public function getAdContent() {
  if (!empty($this->slot)) {
    $client = PublisherId::get();
    $this->moduleHandler
      ->alter('adsense', $client);
    return [
      '#theme' => 'adsense_cse_v2_searchbox',
      '#client' => $client,
      '#slot' => $this->slot,
    ];
  }
  return [];
}