You are here

function _dfp_target_form in Doubleclick for Publishers (DFP) 7

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

Helper form builder for an individual target.

1 call to _dfp_target_form()
_dfp_targeting_form in ./dfp.admin.inc
Helper form builder for the targeting form.

File

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

Code

function _dfp_target_form(&$form, $key, $data = array()) {
  $form['targeting'][$key] = array(
    '#prefix' => '<div class="target" id="target-' . $key . '">',
    '#suffix' => '</div>',
    '#element_validate' => array(
      'dfp_target_form_validate',
    ),
  );
  $form['targeting'][$key]['target'] = array(
    '#type' => 'textfield',
    '#title_display' => 'invisible',
    '#title' => t('Target Name'),
    '#size' => 10,
    '#default_value' => isset($data['target']) ? $data['target'] : '',
    '#parents' => array(
      'targeting',
      $key,
      'target',
    ),
    '#attributes' => array(
      'class' => array(
        'field-target-target',
      ),
    ),
  );
  $form['targeting'][$key]['value'] = array(
    '#type' => 'textfield',
    '#title_display' => 'invisible',
    '#title' => t('Target Value'),
    '#size' => 20,
    '#default_value' => isset($data['value']) ? $data['value'] : '',
    '#parents' => array(
      'targeting',
      $key,
      'value',
    ),
    '#attributes' => array(
      'class' => array(
        'field-target-value',
      ),
    ),
  );
  if (empty($data)) {
    $form['targeting'][$key]['target']['#description'] = t('Example: color');
    $form['targeting'][$key]['value']['#description'] = t('Example: red,white,blue');
  }
}