You are here

public static function BlazyBreakpoint::cleanUpBreakpoints in Blazy 7

Cleans up empty, or not so empty, breakpoints.

Parameters

array $settings: The settings being modified.

Overrides BlazyBreakpointInterface::cleanUpBreakpoints

File

src/BlazyBreakpoint.php, line 113

Class

BlazyBreakpoint
Implements BlazyBreakpointInterface.

Namespace

Drupal\blazy

Code

public static function cleanUpBreakpoints(array &$settings = []) {
  if (!empty($settings['breakpoints'])) {
    $breakpoints = array_filter(array_map('array_filter', $settings['breakpoints']));
    $settings['breakpoints'] = NestedArray::filter($breakpoints, function ($breakpoint) {
      return !(is_array($breakpoint) && (empty($breakpoint['width']) || empty($breakpoint['image_style'])));
    });
  }
}