While #1699378: Allow tokens in entity reference views selection arguments is a great initiative, we need to take it further. If the provided contextual filter value consists of one or more tokens representing field values on the entity being created/edited, it's not available until after the entity is saved. This results in users needing to save it with dependent fields, and then re-edit it, which is horrible UX. This makes even less sense if dependent fields are required, because there may not be any options to select if the entity hasn't been saved yet.
In Drupal 7, this could be done with Dynamic dependent fields or Reference field option limit. In Drupal 8, it can be done with Business Rules' dependent field functionality.
While it's possible to fix this with the help of Contrib, it would be great to get this fixed in Core without too much effort given what's possible with JavaScript API AJAX Forms. (This is what Business Rules is using so it's a good PoC.)
I'm not sure if this issue should be postponed until the other one is done, or whether these can be developed in parallel. I initially thought we should postpone it, but Business Rules is doing this with its own reference method. If we go that route, we don't have to wait, but it would be nice to not have to add additional reference methods. We could simply add this functionality to Views: Filter by an entity reference view.
Comments
Comment #2
colanComment #4
colan