You are here

function template_preprocess_dfp_tag in Doubleclick for Publishers (DFP) 7.2

Same name and namespace in other branches
  1. 7 dfp.module \template_preprocess_dfp_tag()

Preprocess function for DFP tags.

File

./dfp.module, line 1006

Code

function template_preprocess_dfp_tag(&$variables) {
  $tag = $variables['tag'];
  $tag = _dfp_prepare_adunit($tag);
  $slug_placement = variable_get('dfp_slug_placement', 0);

  // Format certain tag properties for display.
  $tag->adunit = dfp_token_replace('[dfp_tag:network_id]/' . $tag->adunit, $tag, array(
    'sanitize' => TRUE,
    'clear' => TRUE,
  ));
  $tag->size = dfp_format_size($tag->size);
  $tag->slug = dfp_format_slug($tag->slug);

  // Create the attributes for the wrapper div and placeholder div.
  $variables['placeholder_attributes'] = array(
    'id' => $tag->placeholder_id,
    'class' => array(
      'dfp-tag-wrapper',
    ),
  );
  if (!empty($tag->slug) && $slug_placement == 1) {
    $variables['slug'] = array(
      '#type' => 'container',
      '#attributes' => array(
        'class' => array(
          'slug',
        ),
      ),
      'slug' => array(
        '#markup' => check_plain($tag->slug),
      ),
      '#weight' => -1,
    );
  }

  // Define a javascript ad slot for this tag.
  _dfp_js_slot_definition($tag);

  // Flag the slot as processed.
  $variables['tag']->processed = TRUE;
}