I have an entity_reference field in a content type: field_node_ref
In the field definition, it can reference all the nodes of a given type.
The widget used for this field is a select
widget
Depending the context, in the node edit form, I would like to use different views to populate the #options
of the select
widget.
Ex:
Context A --> View A will be used
Context B --> View B will be used
The context is calculated in my business logic (I speak about it to show that multiple views can be used and then, it can't be encoded in the field definition)
In my_module_form_alter
the #options
are already populated and I can't update the select widget array to populate them with a custom view. I assume, I have to hook before, but I don't know how.