You are here

function _dfp_breakpoint_form in Doubleclick for Publishers (DFP) 7

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

Helper form builder for an individual breakpoint.

1 call to _dfp_breakpoint_form()
_dfp_breakpoints_form in ./dfp.admin.inc
Helper form builder for the breakpoints form.

File

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

Code

function _dfp_breakpoint_form(&$form, $key, $data = array()) {
  $form['breakpoints'][$key] = array(
    '#prefix' => '<div class="breakpoint" id="breakpoint-' . $key . '">',
    '#suffix' => '</div>',
    '#element_validate' => array(
      'dfp_breakpoint_form_validate',
    ),
  );
  $form['breakpoints'][$key]['browser_size'] = array(
    '#type' => 'textfield',
    '#title_display' => 'invisible',
    '#title' => t('Minimum Browser Size'),
    '#size' => 10,
    '#default_value' => isset($data['browser_size']) ? $data['browser_size'] : '',
    '#parents' => array(
      'breakpoints',
      $key,
      'browser_size',
    ),
    '#attributes' => array(
      'class' => array(
        'field-breakpoint-browser-size',
      ),
    ),
  );
  $form['breakpoints'][$key]['ad_sizes'] = array(
    '#type' => 'textfield',
    '#title_display' => 'invisible',
    '#title' => t('Ad Sizes'),
    '#size' => 20,
    '#default_value' => isset($data['ad_sizes']) ? $data['ad_sizes'] : '',
    '#parents' => array(
      'breakpoints',
      $key,
      'ad_sizes',
    ),
    '#attributes' => array(
      'class' => array(
        'field-breakpoint-ad-sizes',
      ),
    ),
  );
  $form['breakpoints'][$key]['delete_breakpoint'] = array(
    '#type' => 'textfield',
    '#title_display' => 'invisible',
    '#title' => t('Ad Sizes'),
    '#size' => 20,
    '#default_value' => isset($data['ad_sizes']) ? $data['ad_sizes'] : '',
    '#parents' => array(
      'breakpoints',
      $key,
      'ad_sizes',
    ),
    '#attributes' => array(
      'class' => array(
        'field-breakpoint-ad-sizes',
      ),
    ),
  );
  if (empty($data)) {
    $form['breakpoints'][$key]['browser_size']['#description'] = t('Example: 1024x768');
    $form['breakpoints'][$key]['ad_sizes']['#description'] = t('Example: 300x600,300x250. Enter "!none" to suppress this slot for a given browser size.', array(
      '!none' => htmlspecialchars('<none>'),
    ));
  }
}