You are here

function _dfp_breakpoints_form in Doubleclick for Publishers (DFP) 7.2

Same name and namespace in other branches
  1. 7 dfp.admin.inc \_dfp_breakpoints_form()

Helper form builder for the breakpoints form.

1 call to _dfp_breakpoints_form()
dfp_tag_form in plugins/export_ui/dfp_ctools_export_ui.inc
Form builder; Create an ad tag.

File

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

Code

function _dfp_breakpoints_form(&$breakpoints_form, $existing_breakpoints = array()) {

  // Display settings.
  $breakpoints_form['breakpoints'] = array(
    '#type' => 'markup',
    '#tree' => FALSE,
    '#prefix' => '<div id="dfp-breakpoints-wrapper">',
    '#suffix' => '</div>',
    '#theme' => 'dfp_breakpoint_settings',
    '#element_validate' => array(
      'dfp_breakpoints_form_validate',
    ),
  );

  // Add existing breakpoints to the form unless they are empty.
  foreach ($existing_breakpoints as $key => $data) {
    _dfp_breakpoint_form($breakpoints_form, $key, $data);
  }

  // Add one blank set of breakpoint fields.
  _dfp_breakpoint_form($breakpoints_form, count($existing_breakpoints));
  $breakpoints_form['breakpoints']['dfp_more_breakpoints'] = array(
    '#type' => 'submit',
    '#value' => t('Add another breakpoint'),
    '#submit' => array(
      'dfp_more_breakpoints_submit',
    ),
    '#limit_validation_errors' => array(),
    '#ajax' => array(
      'callback' => 'dfp_more_breakpoints_js',
      'wrapper' => 'dfp-breakpoints-wrapper',
      'effect' => 'fade',
      'file' => 'plugins/export_ui/dfp_ctools_export_ui.inc',
    ),
  );
}