You are here

function _dfp_targeting_form in Doubleclick for Publishers (DFP) 7

Same name and namespace in other branches
  1. 7.2 dfp.admin.inc \_dfp_targeting_form()

Helper form builder for the targeting form.

3 calls to _dfp_targeting_form()
dfp_admin_settings in ./dfp.admin.inc
Form builder for the global DFP settings form.
dfp_context_reaction_settings::options_form in plugins/contexts/dfp_context_reaction_settings.inc
Allow admins to choose what DART tags to hide.
dfp_tag_form in plugins/export_ui/dfp_ctools_export_ui.inc
Form builder; Create an ad tag.

File

./dfp.admin.inc, line 361
Admin forms and functinality for DFP ads.

Code

function _dfp_targeting_form(&$targeting_form, $existing_targeting = array()) {

  // Display settings.
  $targeting_form['targeting'] = array(
    '#type' => 'markup',
    '#tree' => FALSE,
    '#prefix' => '<div id="dfp-targeting-wrapper">',
    '#suffix' => '</div>',
    '#theme' => 'dfp_target_settings',
    '#element_validate' => array(
      'dfp_targeting_form_validate',
    ),
  );

  // Add existing targets to the form unless they are empty.
  foreach ($existing_targeting as $key => $data) {
    _dfp_target_form($targeting_form, $key, $data);
  }

  // Add one blank set of target fields.
  _dfp_target_form($targeting_form, count($existing_targeting));
  $targeting_form['targeting']['dfp_more_targets'] = array(
    '#type' => 'submit',
    '#value' => t('Add another target'),
    '#submit' => array(
      'dfp_more_targets_submit',
    ),
    '#limit_validation_errors' => array(),
    '#ajax' => array(
      'callback' => 'dfp_more_targets_js',
      'wrapper' => 'dfp-targeting-wrapper',
      'effect' => 'fade',
      'file' => 'plugins/export_ui/dfp_ctools_export_ui.inc',
    ),
  );
  $targeting_form['tokens'] = array(
    '#theme' => 'token_tree',
    '#token_types' => array(
      'dfp_tag',
      'node',
      'term',
      'user',
    ),
    '#global_types' => TRUE,
    '#click_insert' => TRUE,
    '#dialog' => TRUE,
  );
}