Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293687

Picture module uses config keys with a dot

$
0
0

Updated: Comment #N

Problem/Motivation

The picture module saves configuration files with keys with a dot in them. For example:

id: mapping_one
uuid: 2638a632-9d17-4aa3-b204-4f81e8976db8
label: 'Mapping One'
mappings:
  custom.user.small:
    1x: thumbnail
    2x: ''
  custom.user.medium:
    1x: medium
    2x: ''
  custom.user.large:
    1x: large
    2x: ''
breakpointGroup: atestset
status: true
langcode: en

The use of the breakpoint id, for example custom.user.small does not work out for config because a dot in a config key has a special meaning - the next level in the array. So if you did \Drupal::config('picture.mappings.someentity.yml')-get('mappings.custom.user.small.1x') it would not return a value of thumbnail. This would expect the format to be something like:

id: mapping_one
uuid: 2638a632-9d17-4aa3-b204-4f81e8976db8
label: 'Mapping One'
mappings:
  custom:
    user:
      small:
        1x: thumbnail
        2x: ''
      medium:
        1x: medium
        2x: ''
      large:
        1x: large
        2x: ''
breakpointGroup: atestset
status: true
langcode: en

Additionally dots inside config key names completely break config schemas.

Proposed resolution

We have two possible solutions:

  • Make the picture mapping config entity produce configuration as described in the second YAML structure above
  • Translate the breakpoint id to not contain dots

Remaining tasks

  • Agree solution
  • Create patch
  • Test
  • Review

User interface changes

None

API changes

Probable config schema change and maybe changes to the picture mapping config entity.


Viewing all articles
Browse latest Browse all 293687

Trending Articles