You are here

public function OldCodeAd::getAdPlaceholder in Google AdSense integration 8

Return the ad placeholder.

Return value

array ad placeholder

Overrides AdsenseAdInterface::getAdPlaceholder

File

oldcode/src/Plugin/AdsenseAd/OldCodeAd.php, line 58

Class

OldCodeAd
Provides an AdSense old code ad unit.

Namespace

Drupal\adsense_oldcode\Plugin\AdsenseAd

Code

public function getAdPlaceholder() {
  if (!empty($this->format)) {
    $client = PublisherId::get();

    // Get width and height from the format.
    list($width, $height) = $this
      ->dimensions($this->format);
    $content = $this->configFactory
      ->get('adsense.settings')
      ->get('adsense_placeholder_text');
    $content .= "\nclient = {$client}\nformat = {$this->format}\nwidth = {$width}\nheight = {$height}\nstyle = {$this->style}\nchannel = {$this->channel}";
    return [
      '#content' => [
        '#markup' => nl2br($content),
      ],
      '#format' => $this->format,
      '#width' => $width,
      '#height' => $height,
    ];
  }
  return [];
}