You are here

function dfp_context_reaction_adunit::execute in Doubleclick for Publishers (DFP) 7

Same name and namespace in other branches
  1. 7.2 plugins/contexts/dfp_context_reaction_adunit.inc \dfp_context_reaction_adunit::execute()

override all tags based on context.

File

plugins/contexts/dfp_context_reaction_adunit.inc, line 59
Context reaction plugin for DFP ads.

Class

dfp_context_reaction_adunit
Expose DFP tags as context reactions.

Code

function execute(&$tag) {

  // Check each currently set context to see if the DART tag specified by
  // machinename should be overridden or not.
  foreach ($this
    ->get_contexts() as $context_name => $context) {
    if (isset($context->reactions['dfp_adunit'])) {
      $tags = $context->reactions['dfp_adunit']['adunit_override_tags'];
      if (isset($tags[$tag->machinename]) && !empty($tags[$tag->machinename])) {
        $tag->adunit = $context->reactions['dfp_adunit']['adunit_override'];
      }
      break;
    }
  }
}