Problem/Motivation
Other events triggered by the ConfigImporter has the ConfigImporter object attached to allow listeners to react to the changes it is making. For example, \Drupal\Core\Config\ConfigEvents::IMPORT has it which allows \Drupal\default_content\Config\DefaultContentConfigSubscriber to install default content from modules installed during the import. Because the MissingContentEvent does not have it the Default content module cannot determine what content it is going to create and therefore it can't respond to the event correctly.
See #2849128: Add handling of ConfigEvent::IMPORT_MISSING_CONTENT for the contrib issue this blocks
Proposed resolution
Add the ConfigIMporter object to the event.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3414993
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:
- 3414993-add-configimporter-to
changes, plain diff MR !6202
Comments
Comment #2
alexpottComment #3
alexpottComment #5
andypostI think we can thread it as a bug because the event is not really a migrate event
Comment #6
alexpott@andypost what does Migrate have to do with it?
Comment #7
andypostSorry, I mean config import event
Comment #8
alexpottBut it is a Config import event - is only triggered by the ConfigImporter - see the constructor...
Comment #9
smustgrave commentedRan locally and got
To show the test-coverage. Couldn't run the test-only feature here.
Test of code change appears fine though and didn't appear to break anything.
Comment #10
longwaveWas on the fence about backporting this as it adds a tiny bit of API but this seems unlikely to be unused outside of the ConfigImporter and if backporting allows us to unblock contrib then let's do that.
Committed and pushed eafa856443 to 11.x and 476e65a1e1 to 10.2.x. Thanks!
Comment #14
andypostThank you a lot, it is great help for default content!
Comment #15
jurgenhaasHmm, we're using the MissingContentEvent in our unit tests for ECA and they're now failing. Should we add the config importer argument in our tests and ignore the warning about too many arguments in earlier core versions?
Comment #16
longwaveWhoops, I thought I searched contrib and found no uses, maybe an error on my part. Happy to revert and rework it if that solves the issue.
Comment #17
jurgenhaasNot sure if it's worth it, don't want to hold back some otherwise unblocking improvements. We're "only" using this is a unit test, and could just add that second argument there. It shouldn't break anything for users, I suspect.
Comment #21
longwaveLooking at it again, decided to revert; let's add a default value for that new argument so existing callers don't break.
Comment #22
quietone commented