function dfp_breakpoints_trim in Doubleclick for Publishers (DFP) 7
Same name and namespace in other branches
- 7.2 dfp.admin.inc \dfp_breakpoints_trim()
Helper function that takes a form_state['values'] and removes empty breakpoints.
1 call to dfp_breakpoints_trim()
- dfp_breakpoints_form_validate in ./
dfp.admin.inc - Validation function used by the breakpoints form.
File
- ./
dfp.admin.inc, line 497 - Admin forms and functinality for DFP ads.
Code
function dfp_breakpoints_trim(&$values, $parent = 'breakpoints') {
foreach ($values as $key => &$val) {
if ($key === $parent) {
// We found the browser_size values.
foreach ($val as $k => $v) {
if (empty($val[$k]['browser_size']) && empty($val[$k]['ad_sizes'])) {
unset($val[$k]);
}
}
// Reset the array indexes to prevent wierd behavior caused by a
// breakpoint being removed in the middle of the array.
$val = array_values($val);
break;
}
elseif (is_array($val)) {
dfp_breakpoints_trim($val, $parent);
}
}
}