Problem/Motivation
The save hook reads every field item that is a FileItem, so a contrib field type whose item class extends FileItem is read like core's File and Image. The settings form, however, offers only bundles with a field of type file or image.
A bundle whose only file field is such a contrib type can still participate, set through Drush, a config import or a recipe, and its files are read. But the form does not show it, and it rebuilds the participating list from the checkboxes it showed, so the next save of the form, for any reason, removes that bundle and reading stops without a message.
Found in the review of 1.0.0-alpha1, from the code; the test for this issue will measure it.
Steps to reproduce
- Add a field of a contrib type whose item extends
FileItemto a bundle with no core file or image field. - Make that bundle participate in
content_credentials.settings:participatingthrough Drush or a config import. - Open Configuration → Content authoring → Content credentials: the bundle is not listed.
- Save the form: the bundle is gone from
participating.
Proposed resolution
Decide which bundles to offer the way the hook decides what to read: a field type counts when its item class is FileItem or a subclass of it. Core's File and Image stay as they are; a String field or an entity reference to a file still does not count.
Not in this issue: what the form does with a participating bundle that carries no file field at all. It reads nothing, so dropping it loses no reading.
Remaining tasks
- Tests, then the fix.
User interface changes
The settings form also lists bundles whose file field is a contrib type built on core's file field.
Comments
Comment #4
maurice1969 commentedCommitted to 1.0.x as 76e38db; CI green. The form now offers a bundle when any of its fields has items that are a
FileItem, as the save hook decides. It will be in 1.0.0-alpha2.