Issue #2132551 by Gábor Hojtsy, alexpott, kfritsche: Picture module uses config keys with a dot.
parent
afa7d30c5c
commit
648e362241
|
@ -18,10 +18,16 @@ picture.mappings.*:
|
||||||
label: 'Mappings'
|
label: 'Mappings'
|
||||||
sequence:
|
sequence:
|
||||||
- type: sequence
|
- type: sequence
|
||||||
label: 'Mapping'
|
label: 'Source type'
|
||||||
sequence:
|
sequence:
|
||||||
- type: string
|
- type: sequence
|
||||||
label: 'Image style'
|
label: 'Source'
|
||||||
|
sequence:
|
||||||
|
- type: sequence
|
||||||
|
label: 'Machine name'
|
||||||
|
sequence:
|
||||||
|
- type: string
|
||||||
|
label: 'Image style'
|
||||||
breakpointGroup:
|
breakpointGroup:
|
||||||
type: string
|
type: string
|
||||||
label: 'Breakpoint group'
|
label: 'Breakpoint group'
|
||||||
|
|
|
@ -95,6 +95,16 @@ class PictureMapping extends ConfigEntityBase implements PictureMappingInterface
|
||||||
if (isset($this->breakpointGroup) && is_object($this->breakpointGroup)) {
|
if (isset($this->breakpointGroup) && is_object($this->breakpointGroup)) {
|
||||||
$this->breakpointGroup = $this->breakpointGroup->id();
|
$this->breakpointGroup = $this->breakpointGroup->id();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Split the breakpoint ids into their different parts, as dots as
|
||||||
|
// identifiers are not possible.
|
||||||
|
$loaded_mappings = $this->mappings;
|
||||||
|
$this->mappings = array();
|
||||||
|
foreach ($loaded_mappings as $breakpoint_id => $mapping) {
|
||||||
|
list($source_type, $source, $name) = explode('.', $breakpoint_id);
|
||||||
|
$this->mappings[$source_type][$source][$name] = $mapping;
|
||||||
|
}
|
||||||
|
|
||||||
parent::save();
|
parent::save();
|
||||||
$this->loadBreakpointGroup();
|
$this->loadBreakpointGroup();
|
||||||
$this->loadAllMappings();
|
$this->loadAllMappings();
|
||||||
|
@ -129,10 +139,14 @@ class PictureMapping extends ConfigEntityBase implements PictureMappingInterface
|
||||||
$this->mappings = array();
|
$this->mappings = array();
|
||||||
if ($this->breakpointGroup) {
|
if ($this->breakpointGroup) {
|
||||||
foreach ($this->breakpointGroup->getBreakpoints() as $breakpoint_id => $breakpoint) {
|
foreach ($this->breakpointGroup->getBreakpoints() as $breakpoint_id => $breakpoint) {
|
||||||
|
// Get the components of the breakpoint ID to match the format of the
|
||||||
|
// configuration file.
|
||||||
|
list($source_type, $source, $name) = explode('.', $breakpoint_id);
|
||||||
|
|
||||||
// Get the mapping for the default multiplier.
|
// Get the mapping for the default multiplier.
|
||||||
$this->mappings[$breakpoint_id]['1x'] = '';
|
$this->mappings[$breakpoint_id]['1x'] = '';
|
||||||
if (isset($loaded_mappings[$breakpoint_id]['1x'])) {
|
if (isset($loaded_mappings[$source_type][$source][$name]['1x'])) {
|
||||||
$this->mappings[$breakpoint_id]['1x'] = $loaded_mappings[$breakpoint_id]['1x'];
|
$this->mappings[$breakpoint_id]['1x'] = $loaded_mappings[$source_type][$source][$name]['1x'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the mapping for the other multipliers.
|
// Get the mapping for the other multipliers.
|
||||||
|
@ -140,8 +154,8 @@ class PictureMapping extends ConfigEntityBase implements PictureMappingInterface
|
||||||
foreach ($breakpoint->multipliers as $multiplier => $status) {
|
foreach ($breakpoint->multipliers as $multiplier => $status) {
|
||||||
if ($status) {
|
if ($status) {
|
||||||
$this->mappings[$breakpoint_id][$multiplier] = '';
|
$this->mappings[$breakpoint_id][$multiplier] = '';
|
||||||
if (isset($loaded_mappings[$breakpoint_id][$multiplier])) {
|
if (isset($loaded_mappings[$source_type][$source][$name][$multiplier])) {
|
||||||
$this->mappings[$breakpoint_id][$multiplier] = $loaded_mappings[$breakpoint_id][$multiplier];
|
$this->mappings[$breakpoint_id][$multiplier] = $loaded_mappings[$source_type][$source][$name][$multiplier];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue