I can delete an entity browser even though a field is currently referencing it in its form display.
The entity browser entity should implement ConfigEntityInterface::calculateDependencies() and prevent this / warn that the field is going to be changed.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | interdiff.txt | 792 bytes | marcoscano |
| #5 | 2807853-5.patch | 842 bytes | marcoscano |
| #3 | 2807853-3.patch | 1.6 KB | marcoscano |
Comments
Comment #2
slashrsm commentedI think that we should do it the other way around. Components that are using entity browsers should declare them as dependencies. Fields widgets that this module ships with are a good candidate it seems.
Comment #3
marcoscanoSomething like this?
Manually tested and it appears to work as expected, after this modification when deleting an entity browser being referenced, the confirmation screen is shown, indicating that the display settings on the node form will be updated.
Have a doubt though on the
->getSetting()call. Is it possible that this returns a non-empty but invalid value? (like an empty array or something like this) In this case it would be better to wrap this inside an!empty()check.Comment #4
slashrsm commentedLooks OK to me. Just a nitpik:
Since FileBrowserWidget extends EntityReferenceBrowserWidget we don't need to re-implement same logic again.
You could try to load the entity browser to be sure. If this value is wrong there will be much more problems than just wrong dependencies though.
Comment #5
marcoscanoTrue, sorry!
Comment #6
slashrsm commentedCommitted. Thanks!