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: Unable to add more than one relationship field entry in a grid field

Status Resolved
Add-on / Version Publisher 3.9.1
Severity
EE Version 6.5.4

Gavin @ JCOGS

Mar 03, 2023

This was working with earlier version of Publisher - seems to have happened after update to 3.9.1.
Have a channel that contains a grid field, which in turn contains a relationship field.
It appears I can only define one relationship entry - and only in the first row in the grid.
Relationships can be specified on other rows of the grid, but when entry is saved, these relationships are not saved.
I have found that I can manually over-ride this behaviour by adding entries manually to the table exp_publisher_relationships, but this is not a practical solution as even though after manual entry additional relationship entries show in the grid (and are acted on by EE) the additional entries disappear when entry is next saved. Plus working out the row-id and entry information to simulate the correct row in that table it is time-consuming.
Unclear what additional access / information you need to work on this - suggest you DM via Slack or some such to advise what you need.

#1

BoldMinded (Brian)

Can you share a video of what you’re seeing? Also what are your persistence settings?

#2

Gavin @ JCOGS

Comment has been marked private.

#3

Gavin @ JCOGS

Comment has been marked private.

#4

BoldMinded (Brian)

I checked both those urls in Safari and Firefox, neither worked. Blank white pages for both :(

#5

Gavin @ JCOGS

Comment has been marked private.

#6

BoldMinded (Brian)

I clicked the link in the notification email and it worked, saw the video. Yeah that is kind of weird. What is the PUBLISHER_BUILD_VERSION value in the add-on.setup.php file?

#7

BoldMinded (Brian)

And do you know what the previous build version was that you upgraded from? I can look through my git log but it might be helpful if you can provide these values.

#8

Gavin @ JCOGS

The build version is f2adba94

#9

Gavin @ JCOGS

I think the previous build version (at least one of them) was 849be99c

#10

BoldMinded (Brian)

The only thing I see that affects any changes to Grid or Relationship fields is this. Maybe go to a previous version of the GridType.php file and see if that changes anything?

https://www.dropbox.com/s/en76yskrv8tldq0/ticket-2620-grid.png?dl=0

#11

Gavin @ JCOGS

I reverted to the version in 849be99c and it does not appear to have made a difference :(

Have put in a question to PT to see if there are any underlying changes in Grid Field operations in EE6 that have happened recently. But as a test I disabled Publisher and tried adding a second relationship to the grid entries - and that worked fine - re-enabled Publisher and re-saved the page and entry disappered… so looks like it is something Publisher is doing that is causing the problem.

#12

BoldMinded (Brian)

Try this build, it’s slightly newer than what you have, just to make sure we’re on the same page. https://www.icloud.com/iclouddrive/09b1Tf7suq2NdQAgg8pKo7Sbg#publisher-3.9.1-develop-84169571

I tested locally, although in EE 7, and didn’t have any issue assigning multiple relationships to each Grid row. I even changed the default language to non-English b/c I see that is how you’re setup, and still couldn’t replicate it.

#13

Gavin @ JCOGS

I’ve updated the version of the add-on but it has not changed the behaviour. So I went and had a look to see if there are other grid fields with relationships in to see if it is just this field that is affected, and found a similar field (3 text fields, 1 structure link, and 1 relationship). The alternative field appears to work - and that works OK (as in you can assign relationship entries to more than one row) - but still behaves oddly: if you assign two relationships to the main language page and go to one of the other language pages, the two relationships show up on those language pages. However if you try to remove one of the relationships from one of the other language pages it can not be removed from the entry (or any of the others). This is consistent with the behaviour of relationship fields not in grids - as in you can only edit when viewed in the main language - but I guess for grid fields whatever prevents editing in non-main language is missing… I have had a look at the field definition and the database and cannot see anything obviously amiss with the field that is not working. PT have confirmed that there have been no changes to Grid code recently that might explain observed behaviour. Any ideas?

#14

BoldMinded (Brian)

It looks like you have a lot of fields set to ignored, is this Grid field one of the ignored fields? If so try not ignoring it and see what happens. At least this will give me something to focus on in the codebase to troubleshoot it.

#15

Gavin @ JCOGS

I’m not 100% sure how the ignored settings work - but by my reading only 13 fields (out of 119) are currently being ignored. Persistence - grid fields and relationships are set to be persistent. The field concerned (which is the CTAs part of the ignore option “Content Block Options, 3 Column Comparison Tables, 2 Column Comparison Tables / CTAs” is not being ignored. HTH

#16

BoldMinded (Brian)

Have you tried making a backup of your db, removing all the ignored options so nothing is ignored, and see if that makes a difference?

Have you tried making a new grid field with a relationship column and seeing if that makes a diff?

Is the current behavior consistent on any grid field with a relationship or just this one field? And is it all entries using this field?

#17

Gavin @ JCOGS

So there are 18 entries in the channel that uses this grid / relationship construction. As an indication that this structure used to work, several of the entries (that have not been touched by edits recently) continue to work as they used to (i.e. there is more than one relationship value defined in the grid for the entry). For example https://newfd.jcogs.net/vps-woocommerce - at the bottom of the page are a row of buttons labelled “Prueba 1 mes gratis” - these each pop up a modal - indicating that the underlying grid row in the channel entry has a relationship value. However any attempt to save the entry (without any changes) results in all the grid row values disappearing. I tried removing all ignored entries (fields, channels, types) and it made no difference to this behaviour. So I tried creating a duplicate grid field to the one that is causing problems and added it to the channel concerned. The new / duplicate grid field appears to work perfectly well - in that relationships are persistent between saves. At least in the short term, in the interests of expediency, I guess I will recreate the grid entries for 18 channel entries that appear to be affected by the issue and hope it goes away. But this in itself is not a good solution - as I don’t know if the same issue is present on other grid fields with relationships, nor why this issue arose. If you have any thoughts on what might be going on do let me know.

#18

BoldMinded (Brian)

Comment has been marked private.

#19

Gavin @ JCOGS

Old one - I’m currently resetting the database to a backup after each test. I’ve not got time right now to recreate the field, reload the data, will do tonight I guess.

#20

Gavin @ JCOGS

But as all is backed up if you want to play with things feel free to etc.

#21

BoldMinded (Brian)

Comment has been marked private.

#22

BoldMinded (Brian)

I’ll review my recent git changes to see why this might have started occurring in a previous build. If this Fluid field is valid and you can’t delete it then I’ll have to look into how to fix this going forward.

#23

Gavin @ JCOGS

Comment has been marked private.

Login to reply