function picture_background_formatter_picture_breakpoint_data in Picture Background Formatter 7
Queries the breakpoint data for the requested picture mapping.
Parameters
array $picture_mapping: Desired Picture Mapping to pull Breakpoint Data from.
Return value
array An array of breakpoints, their sizes, and multipliers.
See also
picture_background_formatter_generate_background_css()
1 call to picture_background_formatter_picture_breakpoint_data()
- picture_background_formatter_generate_background_css in ./
picture_background_formatter.module - CSS Generator Helper Function.
File
- ./
picture_background_formatter.module, line 171 - Hooks and functions for the Picture Background Formatter module.
Code
function picture_background_formatter_picture_breakpoint_data($picture_mapping) {
$mapping = picture_mapping_load($picture_mapping);
$mapping_breakpoints = array_reverse(picture_get_mapping_breakpoints($mapping));
$picture_breakpoint_data = array();
reset($mapping_breakpoints);
$first = key($mapping_breakpoints);
foreach ($mapping_breakpoints as $breakpoint_name => $breakpoint_values) {
// Mark breakpoint as invalid if it consists of a type other than an
// image_style type.
$invalid = FALSE;
foreach ($breakpoint_values as $values) {
if ($values['mapping_type'] != "image_style") {
$invalid = TRUE;
}
}
// Skip invalid breakpoints.
if ($invalid) {
watchdog('picture_background_formatter', 'Breakpoint %breakpoint was skipped due to the misconfigured %mapping Picture Mapping.', array(
'%breakpoint' => $breakpoint_name,
'%mapping' => $mapping
->label(),
), WATCHDOG_NOTICE, NULL);
continue;
}
if ($breakpoint_name === $first) {
$picture_breakpoint_data["default"] = $mapping_breakpoints[$breakpoint_name];
}
else {
$breakpoint_data = breakpoints_breakpoint_load_by_fullkey($breakpoint_name);
$picture_breakpoint_data[$breakpoint_data->breakpoint] = $mapping_breakpoints[$breakpoint_name];
}
}
return $picture_breakpoint_data;
}