You are here

function simpleads_preprocess_simpleads_img_element in SimpleAds 7

Preprocess for simpleads_img_element.tpl.php

1 string reference to 'simpleads_preprocess_simpleads_img_element'
simpleads_theme in includes/simpleads.theme.inc
Implements hook_theme().

File

includes/simpleads.theme.inc, line 80
SimpleAds Theme.

Code

function simpleads_preprocess_simpleads_img_element(&$vars) {
  $link_attributes = array();
  $image_attributes = array();
  $vars = _simpleads_theme_attributes_init($vars);
  _simpleads_increase_impression($vars['ad']['node']);

  // Image attributes
  $image_attributes['path'] = $vars['ad']['image_uri'];
  $image_attributes['alt'] = check_plain($vars['ad']['alt']);
  if (isset($vars['settings']['ads_width']) && is_numeric($vars['settings']['ads_width'])) {
    $image_attributes['width'] = check_plain($vars['settings']['ads_width']);
  }
  if (isset($vars['settings']['ads_height']) && is_numeric($vars['settings']['ads_height'])) {
    $image_attributes['height'] = check_plain($vars['settings']['ads_height']);
  }

  // Link attributes
  $link_attributes['html'] = TRUE;
  if ($vars['ad']['target'] && !user_access('administer nodes')) {
    $link_attributes['attributes']['target'] = '_blank';
  }
  $vars['link_attributes'] = $link_attributes;
  $vars['image_attributes'] = $image_attributes;
}