You are here

function simpleads_preprocess_simpleads_text_element in SimpleAds 7

Preprocess for simpleads_text_element.tpl.php

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

File

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

Code

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

  // Link attributes
  $link_attributes['html'] = TRUE;
  if ($vars['ad']['target'] && !user_access('administer nodes')) {
    $link_attributes['attributes']['target'] = '_blank';
  }
  $text_ad = "";
  if (!empty($vars['ad']['destination_url']) && $vars['ad']['text_format'] == 'plain_text') {
    $text_ad = l($vars['ad']['text'], $vars['ad']['url'], $link_attributes);
  }
  else {
    $text_ad = $vars['ad']['text'];
  }
  $vars['text_ad'] = $text_ad;
}