You are here

function theme_ad_image_ad in Advertisement 7

Same name and namespace in other branches
  1. 6.3 image/ad_image.module \theme_ad_image_ad()
  2. 6 image/ad_image.module \theme_ad_image_ad()
  3. 6.2 image/ad_image.module \theme_ad_image_ad()

Return a themed ad of type ad_image.

Parameters

@ad: The ad object.

Return value

A string containing the ad markup.

1 theme call to theme_ad_image_ad()
ad_image_display_ad in image/ad_image.module
Function used to display the selected ad.

File

image/ad_image.module, line 23
Enhances the ad module to support banner ads.

Code

function theme_ad_image_ad(&$variables) {
  $ad = $variables['ad'];
  if (isset($ad->aid) && (isset($ad->filepath) || isset($ad->remote_image))) {
    $output = '<div class="image-advertisement" id="ad-' . $ad->aid . '">';
    if (isset($ad->url) && !empty($ad->url)) {
      $image = theme('ad_image_image', array(
        'path' => !empty($ad->remote_image) ? $ad->remote_image : $ad->filepath,
        check_plain($ad->tooltip),
        'alt' => check_plain($ad->tooltip),
      ));
      $output .= l($image, $ad->redirect . '/@HOSTID___', array(
        'attributes' => ad_link_attributes(),
        'absolute' => TRUE,
        'html' => TRUE,
      ));
    }
    else {
      $output .= theme('ad_image_image', array(
        'path' => !empty($ad->remote_image) ? $ad->remote_image : $ad->filepath,
        check_plain($ad->tooltip),
        'alt' => check_plain($ad->tooltip),
      ));
    }
    $output .= '</div>';
    return $output;
  }
}