Note: This first needs #2262975: Non-Multiple field types with per-field storage are not supported in CckFieldValues.
Problem/Motivation
image and file fields in D6 and D7 use fid for the file ID, term fields use tid in 7.x. Node reference fields use nid, and so on...
Everything uses target_id in D8.
This kind of works right now but only because FieldCckValues doesn't support non-multiple/multi-property fields, which will be fixed by the issue above, but that will result in having fid/nid and so on in the source values, that will then be ignored by the target field.
So we need a way to convert/rename them.
Proposed resolution
The attached patch adds a transformer plugin, which can be configured like this:
target_field:
plugin: transformer
source: source_field
map:
nid: target_id
other_field.value: description
I also added support for bringing in other field values because we need this for a custom migration.
Remaining tasks
- Write tests.
- Automatically configure image/file/... reference fields to use that plugin? How will other reference fields from contrib (like node, user, role, whatever-reference field) be supported?
User interface changes
API changes
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | transformer-2272353-1.patch | 2.09 KB | berdir |
Comments
Comment #1
berdirHere's the patch.
Comment #3
benjy commentedLeft over comment.
Why do we need to do this? Can you give an example?
Otherwise the plugin looks good. Can we make use of it and add a test?
Comment #4
ultimikeComment #5
drclaw commentedWould this not be achieved now using the iterator processor? The following works for image fields, for example:
Comment #7
mikeryanPer drclaw - is there still a need for this?
Comment #9
mikeryan