I have a 'plant' content type that references an 'plant event' content type (e.g. to capture sowing, flowering, harvesting dates). I want the user to add new plant events per plant node and the entity connect does this well. However, each plant event is particular to any one plant so when I add a new plant I don't want a long list of events that are relevant to other plants. Effectively for every new creation of a plant node I should see no plant events.

To work around this I've created an entity view reference with a contextual filter and a relationship (Entity Reference: Referencing entity). The contextual filter I'm using is 'Provide default value'->'Content ID from url'. This works for plants I've already created as the associated events for that plant node only appear (not all the plant events). And for adding new plant nodes no plant events appear as it should. However the problem lies when I create a new plant event (via the entity connect + button). The plant event is created but on closing the event is not 'added' to my new plant node I am creating. Instead I get an error "An illegal choice has been detected. Please contact the site administrator."

This is no doubt that this error is occurring due to the way I have my contextual filter set up to look for a node ID in the url that isn't there yet (the new plant node is yet to be saved). So I need some way (perhaps php code?) to account for this in my contextual filter. When I create a new plant event it should appear in the reference list for that plant node I am creating.

can someone advise?

thanks

Comments

bib_boy created an issue.

bib_boy’s picture

As an update. I get the same error even when adding a new 'plant event' to an existing 'plant' node (i.e. there is a nid present in the url) . So a bit stuck for a way forward...

bib_boy’s picture

OK, looks like I can use another module and do what I need with Inline Entity Form