Overview
While working on #3469610: Prepare for multiple component types: prefix Component config entity IDs with `sdc` the use of + to separate parts of the config entity ID is still jarring.
Core uses dots freely, for example field.field.node.page.body or core.entity_form_display.media.audio.media_library and ConfigEntityStorage says
* - ID: A string denoting the entity ID within the entity type namespace; e.g.,
* 'article'. Entity IDs may contain dots/periods. The entire remaining string
* after the config_prefix in a config name forms the entity ID. Additional or
* custom suffixes are not possible.
When this was first proposed in #3444417: "Developer-created components": mark which SDCs should be exposed in XB the concern was that SDC IDs, which form part of the config entity name, can also contain dots - but I don't think this matters. For SDCs the format is now sdc+provider+name but with dots that is still fine: sdc.provider.my.dotted.sdc - we can just explode on the first two dots only to extract the name.
Proposed resolution
Replace + with . in component config entity IDs.
User interface changes
None
Issue fork experience_builder-3480193
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
wim leersThis sure would make
Componentconfig entity IDs feel less "alien" to experienced Drupal developers.I'm +1 to giving this a try! 👍
Comment #4
longwaveFind and replace did not take long so I just did it while #3469610: Prepare for multiple component types: prefix Component config entity IDs with `sdc` was fresh in my mind, but postponing as that needs to land first.
Comment #5
longwaveI also spotted that the regex currently disallows dotted SDC names and we have test coverage for this too:
If these are valid, we can deal with them in a followup.
Comment #6
wim leers#3469610: Prepare for multiple component types: prefix Component config entity IDs with `sdc` is in!
Comment #7
wim leersComment #8
longwaveRebased onto 0.x.
Comment #9
longwaveComment #10
wim leersI literally can't find the reason documented in #3444417: "Developer-created components": mark which SDCs should be exposed in XB nor in any Slack history.
To the best of my knowledge, we picked
+as the separator because.might be a valid character in the name of an SDC.But now I think allowing a period in the SDC plugin ID (for example
foo.bar.component.ymlto define afoo.barSDC) is simply an oversight.Since #3444417, I learned of other gaps in SDC's
ComponentPluginManager, such as happily accepting SDC props names containing dashes, even though Twig does not allow dashes in variable names, and hence SDC allows for props names that are impossible to use in Twig! 🙈 See #3465228: Twig disallows dashes in variable names, so SDC should disallow it in prop names and slots.This undeniably looks more familiar/less alien to Drupal developers. So, even though I'd like @f.mazeikis to sign off on this, I think this is a clear improvement towards making XB look more familiar/less alien to the rest of the Drupal community.
Comment #12
wim leers