You are here

function theme_ad_text_ad in Advertisement 7

Same name and namespace in other branches
  1. 6.3 text/ad_text.module \theme_ad_text_ad()
  2. 6 text/ad_text.module \theme_ad_text_ad()
  3. 6.2 text/ad_text.module \theme_ad_text_ad()

Return a themed ad of type ad_text.

Parameters

@ad: The ad object.

Return value

A string containing the ad markup.

1 theme call to theme_ad_text_ad()
ad_text_display_ad in text/ad_text.module
Function used to display the selected ad.

File

text/ad_text.module, line 48
Enhances the ad module to support static text ads.

Code

function theme_ad_text_ad($variables) {
  $ad = $variables['ad'];
  if (isset($ad->aid)) {
    if (!isset($ad->adheader)) {
      $ad = node_load($ad->aid);
    }
    $output = '<div class="text-advertisement" id="ad-' . $ad->aid . '">';
    if (isset($ad->url) && !empty($ad->url)) {
      $output .= theme('ad_text_text', array(
        'header' => ad_text_display_prepare($ad->adheader, filter_default_format()),
        'body' => ad_text_display_prepare($ad->adbody, filter_default_format()),
        'link' => $ad->redirect . '/@HOSTID___',
      ));
    }
    else {
      $output .= theme('ad_text_text', array(
        'header' => ad_text_display_prepare($ad->adheader, filter_default_format()),
        'body' => ad_text_display_prepare($ad->adbody, filter_default_format()),
      ));
    }
    $output .= '</div>';
    return $output;
  }
}