Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: syncing of an entries’s language versions

Status Resolved
Add-on / Version Publisher 2.11.2
Severity
EE Version 5.2.6

Matthias Ballmann

Aug 20, 2019

We use publishers for a bilingual website and discovered that in the English version (secondary language) the images in grid fields do not change or synchronize when we change the images or their order within a grid or add or delete rows in the German version (primary language).

Since we have enabled the option “Persistent Grid fields / Force Grid fields to have the same number of rows in all languages”, we wonder if this is the intention and normal behavior or if there is an error?

And as an extension of the question: Is it possible to change images or files in grids only in the primary version, but block this in the secondary version?


kind regards
matthias

#1

BoldMinded (Brian)

Matthias, can you create a video describing the issue? I think I understand what you are describing, but seeing it first hand would be helpful.

#2

BoldMinded (Brian)

Thanks for sending the video. Based on what I know about how the Grid implementation works, this one may take awhile to figure out. First I have to replicate it locally. In the mean time, can you do me a favor and try to replicate this in a Grid field that does not have a File field in it? I want to know if this is specific to Grid rows that contain File fields or just any Grid field row.

https://d.pr/v/PCjEVX

#3

BoldMinded (Brian)

Matthias, I spent some time looking into this, and I can replicate it. Unfortunately, based on what I know about the scenario is it is going to be very hard to fix this. I don’t think I’m going to be able to get a fix to you in a timely manor, this one could take awhile to figure out, and with everything I have going on with the EE CONF coming up soon, I really have no idea when I can deliver a solution. Honestly I’m not even sure how I can fix this without entirely re-writing how Publisher works with Grid fields. The code that is in place right now has been there for years, so re-writing this is not a small or trivial task. This probably isn’t what you want to hear and I wish I had a better answer for you but this is just a big fat question mark right now for me.

#4

BoldMinded (Brian)

Here is what is happening, for your reference and mine so I don’t forget.

Publisher_hooks_base.php is grouping the results

foreach ($query->result_array as $index => $row) {
                $hash = $row['entry_id'] . '/' . $row['row_order'];
                $grouped[$row['publisher_lang_id']][$row['entry_id']][$hash] = $row;
            }

https://d.pr/i/NkMlLJ

It’s creating an index of the rows for each language and entry, that $hash value is using the row_order value as part of the hash, and in this case the default entry has 3 rows, indexed 0,1,2. If we delete the second row, we’re left with 1,2, but when the Grid rows are re-saved, the order is updated to 0,1. So when we go to display the German content, it knows that it should display rows 5/0 and 5/1, but in this case 5/1 is actually the 3rd row b/c the 2nd row was deleted. So when it goes to try to show the German rows, it thinks it should show rows 5/0 and 5/1, not 5/0 and 5/2 (b/c the middle row was deleted) because those are the two rows associated with the default language.

#5

BoldMinded (Brian)

I have an idea of how I can fix this but I can’t provide an estimate on when I can get it done. Could be a few days, could be a few weeks. I’ll do what I can.

#6

BoldMinded (Brian)

Comment has been marked private.

#7

Matthias Ballmann

hi brian,

thank you so much for the beta version. it took me a bit of time to test it extensively because our new website is very big and it was difficult to make a copy of it. so i made backups and tried it out on the live version. for a better understanding i made a video again:

https://www.dropbox.com/s/pvu2b8dz97sizj6/row-sync-2.mov?dl=0

– I did my tests on a new entry because it seemed that changes to the were not reflexted on older entries (not sure about that, needs more testing). – the behaviour on new entries is good at first but gets a little weird when I delete rows and add new ones. – as can be seen in the video, changing the order of the rows will not be adopted in the english version.

i made a backup of the database before the test. should i return to the previous publisher version and restore the database or can i leave this beta live?

thank you and kind regards matthias

#8

BoldMinded (Brian)

Matthias, if the persistent Grid rows are causing problems for you then I would suggest disabling the feature. It’s going to be some time before I can sort this out if I can sort this out. My previous build had a pretty easy fix for a very specific scenario, but what you just showed in the video is pretty complex. I don’t know when I’m going to have time to look into this or when I can fix it, again, if there is a fix.

Copy of the video in-case Matthias deletes the original https://www.dropbox.com/s/hmzzxqasjqhhwyj/row-sync-2.mov?dl=0

Login to reply