-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matrix content gets overwritten on import #463
Comments
I seem to have the same issue: Matrix content gets overwritten for all sites/languages. Other fields work fine. Craft 3.1.30, Feed Me 4.1.0. |
This happens because Feed Me doesn’t have a way of matching your feed’s blocks with existing entry blocks, so it will always just delete the current entry blocks and recreate them with whatever’s in the feed. You can work around that by enabling the “Manage blocks on a per-site basis” setting on your Matrix field (under “Advanced”), which will cause each site to have its own unique set of blocks. Then Feed Me will only delete the blocks assigned to the current site, replace them with the feed’s blocks. We are considering adding a Unique Identifier setting for Matrix fields within the feed settings, which would give you a way of matching incoming blocks with existing ones. |
About this "so it will always just delete the current entry blocks and recreate them with whatever’s in the feed." - but can it not do that for just the group or the site importing into? Why does it do it for all sites? If I am importing content for say just German, why does it have to overwrite the field in all the other sites? Needs to only overwrite it for that site or group. If its only for the site, then that will be OK providing we can set the matrix block to translate per group. |
What happens if you set the matrix field as "Manage blocks on a per-site basis", import all the sites content, then disable "Manage blocks on a per-site basis"? Because with this setting currently disabled, if I edit a block field that is translatable per group, it does maintain that content within the group sites only. So editing German does not update US. So I am curious what happens when its unchecked, do the blocks all link back up again but with the imported content kept (and therefore linked within each group as now)? Or will it delete all blocks from all sites and re-copy the default site blocks? If its the former then that may work. Edit: Tried it but doesn't work. Once I switch back to not manage blocks on a per site basis, then edit and save an entry, that entry on every site turned the language I saved it in, even though on subsequent saves of that entry it did allow me to have different content. If only on that first save it did not copy across that content to all sites but just the group, and re-saved the content that was in there, then this process should work. |
We just released Craft 3.2 RC1, which replace’s Matrix’s “Manage blocks on a per-site basis” setting with a new “Propagation Method” setting, with the following options:
I’m posting that here because it can serve as a workaround for this issue. For example if you set your Matrix field’s propagation method to “Save blocks to other sites with the same language”, and then import your English feed, only English sites will have their current blocks deleted, and new blocks created based on the feed. Other sites’ blocks will be left alone. It’s not a complete fix for this issue, but it was a lot cleaner than the alternative Feed Me enhancements we are considering, so it’s a good first step. |
Thanks Brandon, I will give this a try and its a great step forward for matrix and multi-sites. I am experiencing a few strange issues, which I guess may be due to the data I had already imported, and one of the issues prevents me deleting it to start again too. I will open a new Github thread on it here craftcms/cms#4450 |
Add multi-site reference to issue craftcms#463
I am using a similar setup. Except that I don't import anything into the matrix field. But on import all blocks inside the matrix field get deleted. Here is what I would like to do:
An option to ignore the matrix field on import would be really nice! |
OMG. There is a config setting for this: |
Unfortunately this setting is used to not update the whole element. Not only a specific field… |
Maybe my PR helps… |
I just ran into this again. Used Feed Me to import some content into existing entries in secondary sites. We have a content-builder Matrix field set to "Only save blocks to the site they were created in" and I had all the Matrix fields set to "Don't Import" in my Feed Me import config. And that Matrix field was completely emptied for all the entries in the site was importing to. Whether or not this is "expected" from a programmatic standpoint, it's definitely not what I would expect as a user – even one who is pretty familiar with Craft's internals. Seems like at the very least it would warrant a big red warning on the feed config page to avoid content loss. |
The scenario where a matrix field is not mapped at all in a feed but each feed run nukes the matrix content entirely seems quite dangerous with no warning or prompt it will happen and the fact this has been open for several years with no resolution makes me sad. Same as: #734. |
Any update on this? I am experiencing a similar issue as @jamesmacwhite describes. My matrix field gets nuked on import while it is not mapped. But it only happens if the matrix field contains a super table field. |
I will close this ticket because the original issue has been resolved. For the recent case, please refer to #734 |
And yet this issue has remained broken for years... It is very destructive with no warning and the docs don't make any mention to the fact unmapped matrix content can be completely nuked, no warning, no reference. I find that a bit irresponsible given how long both respective issues have been around. Considering this is now first party plugin since taken over from Verbb. I have to say, its development has been worse, which is unfortunate. |
Will there be a method in the future to import matrix block data by mapping to a unique identifier or handle in order to add language data to a matching element? Creating unique elements for each site ease the import process but increase the amount of work for creating matrix blocks manually. For example if a matrix block has a field for adding image assets and text in different languages, if in one language you add 10 images and need the same images in the other languages, a content manager would have to painfully add those 10 images for each language just to translate the text. This is extremely inefficient for sites that need to use the same matrix block for importing data and manually creating data. Will this will be addressed or will it be an ongoing problem? Thanks. |
Description
When updating content in a Matrix field content gets overwritten
Steps to reproduce
Additional info
The text was updated successfully, but these errors were encountered: