protected static function BreakpointFormTrait::breakpointsTrim in Doubleclick for Publishers (DFP) 8
Helper function that removes empty breakpoints from form values.
1 call to BreakpointFormTrait::breakpointsTrim()
- BreakpointFormTrait::breakpointsFormValidate in src/Form/ BreakpointFormTrait.php 
- Validation function used by the breakpoints form.
File
- src/Form/ BreakpointFormTrait.php, line 57 
- Contains \Drupal\dfp\Form\BreakpointFormTrait.
Class
- BreakpointFormTrait
- Provides form for adding breakpoints to a DFP tag.
Namespace
Drupal\dfp\FormCode
protected static function breakpointsTrim(array &$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)) {
      self::breakpointsTrim($val, $parent);
    }
  }
}