Skip to content
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 & relation fields aren't getting copied to other locales when new entries are created #16

Closed
angrybrad opened this issue Jan 29, 2017 · 2 comments
Assignees
Labels
bug severity:normal Bugs that affect typical usage

Comments

@angrybrad
Copy link
Member

angrybrad commented Jan 29, 2017

Originally posted by Marion Newlevant on Stack Exchange.


Description

I am attempting to add a second locale to a site with existing content, much of that content in matrix fields.

Following the documentation for Setting Up a Localized Site, I have defined the locale, enabled all sections for this locale (and the original one), set up the configuration and the index.php files. What I have not yet done is mark any field as translatable.

What I was expecting is that entries in the new locale would be initialized with content from the original locale. And this has happened, except that the matrix fields have not been duplicated, so the entries in the new locale do not have any of that matrix content.

This is very similar to How do I get Matrix elements to copy their content across language Locales?. The answer there is "don't mark matrix fields as translatable", which I haven't done, so not sure why this isn't working for me.

Additional Info

This is definitely a bug in Craft. Doesn't just affect Matrix, but any relational field as well (Assets, Users, etc.)

It's not an super-easy fix, but as a workaround, you can re-save the entry in the original locale (before making any edits in the new) and the content will get duplicated over.

@jsunsawyer
Copy link

I just ran into an issue related to this, but it caused me to lose all matrix field content.

Steps to reproduce:

  • Have section with entries that contain matrix fields
  • Add locales for the section. (Default Entry Status = disabled for all new locales)
  • View entry (has matrix field content)
  • Switch to a new locale and set the locale entry status to enabled. (note that no matrix field content has copied over)
  • View original locale (that had matrix field content)
  • See that matrix field content vanished!

The only thing that I have got to work so far is to manually save each entry from the original locale after adding new locales. This copies over matrix field content to the other locales. Re-saving the section says that it's re-saving the entries, but it has no affect in terms of copying over the matrix field content or preventing the deletion of it when enabling a new locale.

Running Craft CMS 2.6.3015

@brandonkelly
Copy link
Member

@jsunsawyer Yeah this is a known issue with Craft 2, and unfortunately not something we are able to fix. We were only able to fix it in Craft 3 after a lot of significant refactoring to how custom fields work. We’d highly recommend you upgrade to Craft 3 if at all possible. Otherwise, whenever adding new sites, be sure to go through and re-save all entries with Matrix / relational data on one of the previously-existing locales, before you start editing the new locale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug severity:normal Bugs that affect typical usage
Projects
None yet
Development

No branches or pull requests

3 participants