Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3485117
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3485117
Commits
648e3622
Commit
648e3622
authored
11 years ago
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2132551
by Gábor Hojtsy, alexpott, kfritsche: Picture module uses config keys with a dot.
parent
afa7d30c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/picture/config/schema/picture.schema.yml
+9
-3
9 additions, 3 deletions
core/modules/picture/config/schema/picture.schema.yml
core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php
+18
-4
18 additions, 4 deletions
...ules/picture/lib/Drupal/picture/Entity/PictureMapping.php
with
27 additions
and
7 deletions
core/modules/picture/config/schema/picture.schema.yml
+
9
−
3
View file @
648e3622
...
...
@@ -18,10 +18,16 @@ picture.mappings.*:
label
:
'
Mappings'
sequence
:
-
type
:
sequence
label
:
'
Mapping
'
label
:
'
Source
type
'
sequence
:
-
type
:
string
label
:
'
Image
style'
-
type
:
sequence
label
:
'
Source'
sequence
:
-
type
:
sequence
label
:
'
Machine
name'
sequence
:
-
type
:
string
label
:
'
Image
style'
breakpointGroup
:
type
:
string
label
:
'
Breakpoint
group'
...
...
This diff is collapsed.
Click to expand it.
core/modules/picture/lib/Drupal/picture/Entity/PictureMapping.php
+
18
−
4
View file @
648e3622
...
...
@@ -95,6 +95,16 @@ public function save() {
if
(
isset
(
$this
->
breakpointGroup
)
&&
is_object
(
$this
->
breakpointGroup
))
{
$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
();
$this
->
loadBreakpointGroup
();
$this
->
loadAllMappings
();
...
...
@@ -129,10 +139,14 @@ protected function loadAllMappings() {
$this
->
mappings
=
array
();
if
(
$this
->
breakpointGroup
)
{
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.
$this
->
mappings
[
$breakpoint_id
][
'1x'
]
=
''
;
if
(
isset
(
$loaded_mappings
[
$
breakpoint_id
][
'1x'
]))
{
$this
->
mappings
[
$breakpoint_id
][
'1x'
]
=
$loaded_mappings
[
$
breakpoint_id
][
'1x'
];
if
(
isset
(
$loaded_mappings
[
$
source_type
][
$source
][
$name
][
'1x'
]))
{
$this
->
mappings
[
$breakpoint_id
][
'1x'
]
=
$loaded_mappings
[
$
source_type
][
$source
][
$name
][
'1x'
];
}
// Get the mapping for the other multipliers.
...
...
@@ -140,8 +154,8 @@ protected function loadAllMappings() {
foreach
(
$breakpoint
->
multipliers
as
$multiplier
=>
$status
)
{
if
(
$status
)
{
$this
->
mappings
[
$breakpoint_id
][
$multiplier
]
=
''
;
if
(
isset
(
$loaded_mappings
[
$
breakpoint_id
][
$multiplier
]))
{
$this
->
mappings
[
$breakpoint_id
][
$multiplier
]
=
$loaded_mappings
[
$
breakpoint_id
][
$multiplier
];
if
(
isset
(
$loaded_mappings
[
$
source_type
][
$source
][
$name
][
$multiplier
]))
{
$this
->
mappings
[
$breakpoint_id
][
$multiplier
]
=
$loaded_mappings
[
$
source_type
][
$source
][
$name
][
$multiplier
];
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment