You are here

function _dfp_targeting_remove_empty in Doubleclick for Publishers (DFP) 7.2

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

Helper function to remove empty target values from a given array.

File

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

Code

function _dfp_targeting_remove_empty(&$target) {
  foreach ($target as $key => $val) {
    if (empty($val['target']) && empty($val['value'])) {
      unset($target[$key]);
    }
  }

  // Reset the target array's indexes to prevents strange behavior when users
  // leave a blank row in the targeting form followed by a filled-in row. In
  // this case clicking "Add another target" will not work as expected.
  $target = array_values($target);
}