You are here

public function TagView::getAdUnit in Doubleclick for Publishers (DFP) 8

Gets the ad unit.

Return value

string The ad unit.

1 call to TagView::getAdUnit()
TagView::getShortTagQueryString in src/View/TagView.php
Gets the short tag query string.

File

src/View/TagView.php, line 139
Contains \Drupal\dfp\View\TagView.

Class

TagView
A value object to combine a DFP tag with global settings for display.

Namespace

Drupal\dfp\View

Code

public function getAdUnit() {
  if (is_null($this->adUnit)) {
    $adunit = $this->tag
      ->adunit();
    if (empty($adunit)) {
      $adunit = $this->globalSettings
        ->get('adunit_pattern');
    }
    $this->adUnit = '/' . $this->globalSettings
      ->get('network_id') . '/' . $this->token
      ->replace($adunit, $this, [
      'clear' => TRUE,
    ]);
  }
  return $this->adUnit;
}