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

Issue with Locales Super Table within a Matrix Field #22

Closed
jonathanhudak opened this issue Jul 28, 2015 · 13 comments
Closed

Issue with Locales Super Table within a Matrix Field #22

jonathanhudak opened this issue Jul 28, 2015 · 13 comments
Labels

Comments

@jonathanhudak
Copy link

Hello,

I'm experiencing an issue when saving an entry's alternate locale. I have a matrix field configuration similar to the one described in the readme of this project under "The Row Layout also shines brightest when using inside a Matrix field as below."

Here are the steps to recreate:

  1. Uncheck 'This field is translatable' on the Matrix Field under /Settings/Fields/
  2. Go to page to translate. The alternate locale should have a grey cirlce to the right of its title.
  3. Save the page with Command+S and the alternate locale should now have a green circle.
  4. Click the alternate locale and the matrix fields should be copied over. (this is the only way I've found to copy the matrix fields over from the original locale)
  5. _Check 'This field is translatable' on the Matrix Field under /Settings/Fields/
  6. Go to page to translate and choose the alternate locale, translate text, and save.
    _Issue: Nested SuperTable fields within matrix blocks of the original locale no longer contain their original text content. The alternate locale text *is saved though.

I'm running PHP 5.6.11, Apache/2.4.10 (Unix)

Any thoughts to what might be causing the issue? Thanks in advance. This is an awesome plugin.

Jonathan

@jonathanhudak
Copy link
Author

Just to follow up, my colleague just pointed out this line https://github.com/engram-design/SuperTable/blob/master/supertable/models/SuperTable_BlockModel.php#L24
"If the SuperTable field is translatable, than each individual block is tied to a single locale, and thus aren't
translatable. Otherwise all blocks belong to all locales, and their content is translatable."

Currently I have the parent matrix field set to translatable thus, from my understanding, making the child super table field also translatable. Could this be the cause of the issue I'm describing? If so, this comment doesn't seem to make sense to me. Shouldn't it be the opposite?

Thanks again.

@jonathanhudak
Copy link
Author

Hi once again,
I've just tested this same scenario, but using an un-nested SuperTable field.

Steps:

  1. Create a SuperTable field and assign it to a section.
  2. Create a new entry using that field and command+save.
  3. Click the alternate locale for that entry and the field/s and content should be copied over.
  4. Check 'This field is translatable' on the SuperTable field
  5. Return to the entry, navigate to the alternate locale, edit its text and save.
    Issue the original locale field has empty values.

So this seems to be a bug. I'd be happy to work on a pull request. If you have any insights into where to address I would be awesome to here.

Thanks again.

@engram-design
Copy link
Member

@hudakdidit Thanks for the extensive summary of your issue - helps a lot! I can confirm this is an issue using either Matrix-SuperTable or SuperTable-Matrix field layout. I cannot seem to replicate this issue when using a SuperTable field (with no Matrix at all), and have tested that this works.

I'll investigate further and let you know. Thanks again!

@jonathanhudak
Copy link
Author

@engram-design Thanks for you reply! Yes you're right, I think there was something else at play when I was testing a SuperTable field (with no Matrix at all), it does work properly with locales.

Its seeming like the issue is that when you have a Matrix-SuperTable or SuperTable-Matrix field layout craft isn't able to copy the fields from the original locale to the alternate. My hacky way of duplicating the fields (mentioned above in my original post) is not sustainable with more than 2 locales and was a way of skirting around the actual issue, which is the fields don't copy over.

Since the project I'm working on depends on locales, unfortunately I think I'm going to refactor my layouts without the use of *nested SuperTable fields. I hope this helps, let me know if you need any help testing when you're able to address this. Thanks man!

@superflausch
Copy link

Any news on this one?

I think I have a related or the same issue on a project. I also have a supertable within a matrix block and we also use locales (but only one is active in this section). I have a linkit field (https://github.com/fruitstudios/LinkIt) in the supertable, which causes me the issue.

When I edit a page with the matrix > supertable > linkit combo it stores my changes, but when I open up the entry page again some values are gone. The linkit field still has the value that I choose to link to an entry (dropdown) but lost the actual selected entry.

Cheers.

@engram-design
Copy link
Member

No news yet I'm afraid, but it's something I will start to have a look at properly. Its a bit of a tricky one to test, but I'll make sure this is fixed very soon.

@slelorrain
Copy link

Hello, do you have any news concerning this issue?

I have a supertable within a matrix, and also see that Craft doesn't copy the fields from the original locale to the alternate.

Thanks

@Moorst
Copy link

Moorst commented Aug 11, 2016

Came here looking to use SuperTable as my LinkIt fields are breaking since I've added locales to my site. Has there been any progress on this issue or do I need to continue looking for another solution?

@JonnyBR12
Copy link

+1, found this post as I have the same issue

@engram-design
Copy link
Member

Thanks all for your patience with this issue. @hudakdidit I might refer back to your original issue. I've learnt a lot about nested field translations after this exercise, and nested field localisation is a little complex in Craft. I've noticed native Matrix fields have the same issue.

I've found a workaround for this where you disable localisation on the Super Table or Matrix field, and only allow localisation for child fields. Out of interest - is there a benefit to localising a parent field when all content is contained in child fields? As such, the important information that needs to be localised resides in child fields.

For example, refer to the below screenshot of a Super Table > Matrix setup. Notice only the inner field is the only field marked as translatable. Note - that screenshot shows the new settings layout available in 1.0.0.

screencapture-craft25-craft-dev-office-settings-fields-edit-1357-1472474051542

@cole007
Copy link

cole007 commented Dec 7, 2017

Having problems with using locales on a site using Super Tables pretty extensively.
It seems a bit hit and miss regarding which content is copied across and a task to Resave Elements gets stuck migrating SuperTable content across

@engram-design
Copy link
Member

@cole007 I wonder if thats more an environment, or memory issue, particularly with the stalled task?

@engram-design
Copy link
Member

Closing due to age/Craft 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants