protected function PictureMapping::loadAllMappings in Picture 7.2
Loads all mappings and removes non-existing ones.
2 calls to PictureMapping::loadAllMappings()
- PictureMapping::setBreakpointGroup in includes/
PictureMapping.php - Set the breakpoint group.
- PictureMapping::setValues in includes/
PictureMapping.php - Set data values based on schema.
File
- includes/
PictureMapping.php, line 146 - Picture Mapping class.
Class
- PictureMapping
- Picture mapping class.
Code
protected function loadAllMappings() {
$loaded_mappings = $this->mapping;
$all_mappings = array();
if ($breakpoint_group = $this->breakpoint_group) {
$breakpoints = $breakpoint_group->breakpoints;
foreach ($breakpoints as $breakpoint_id) {
$breakpoint = breakpoints_breakpoint_load_by_fullkey($breakpoint_id);
if ($breakpoint) {
// Get the mapping for the default multiplier.
$all_mappings[$breakpoint_id]['1x'] = '';
if (isset($loaded_mappings[$breakpoint->machine_name]['1x'])) {
$all_mappings[$breakpoint_id]['1x'] = $loaded_mappings[$breakpoint->machine_name]['1x'];
}
// Get the mapping for the other multipliers.
if (isset($breakpoint->multipliers) && !empty($breakpoint->multipliers)) {
foreach ($breakpoint->multipliers as $multiplier => $status) {
if ($status) {
$all_mappings[$breakpoint_id][$multiplier] = '';
if (isset($loaded_mappings[$breakpoint->machine_name][$multiplier])) {
$all_mappings[$breakpoint_id][$multiplier] = $loaded_mappings[$breakpoint->machine_name][$multiplier];
}
}
}
}
}
}
}
$this->mapping = $all_mappings;
}