You are here

function dfp_context_reaction_settings::options_form in Doubleclick for Publishers (DFP) 7

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

Allow admins to choose what DART tags to hide.

Overrides context_reaction::options_form

File

plugins/contexts/dfp_context_reaction_settings.inc, line 15
Context reaction plugin for DFP ads.

Class

dfp_context_reaction_settings
Expose DFP variables as context reactions.

Code

function options_form($context) {
  module_load_include('inc', 'dfp', 'dfp.admin');

  // Get existing values for this form.
  $values = $this
    ->fetch_from_context($context);

  // Build the targeting form.
  $form = array();
  _dfp_targeting_form($form, isset($values['targeting']) ? $values['targeting'] : array());

  // Modify the #parents property to make sure values are stored in the
  // location that contexts expects them.
  $parents = array(
    'reactions',
    'plugins',
    'dfp_settings',
  );
  foreach (element_children($form['targeting']) as $key) {
    if (is_numeric($key)) {
      $form['targeting'][$key]['target']['#parents'] = array_merge($parents, $form['targeting'][$key]['target']['#parents']);
      $form['targeting'][$key]['value']['#parents'] = array_merge($parents, $form['targeting'][$key]['value']['#parents']);
    }
  }

  // Modify form to call the contexts-specific versions of certain functions.
  $form['targeting']['dfp_more_targets']['#submit'] = array(
    'dfp_contexts_more_targets_submit',
  );
  $form['targeting']['dfp_more_targets']['#ajax']['callback'] = 'dfp_contexts_more_targets_js';
  return $form;
}