Remove items in taxonomy entity relation on node edit form If a field on the node edit form is a entity relation to a taxonomy term vocabulary, I want the taxonomy terms be restricted on certain conditions. I don't know how to do it safely. I have tried it in hook_form alter(). Deep in the "array stack" of the form variable is the definition of the entity reference form field.


  


Is the only way to "hack" the "#process" array, or is there any object-oriented way to filter the items in the drop down element?
Is there any form "plugin" to filter the items in Drupal 8?
You're deep in the field definitions there, that's the wrong place, you can't change anything there and you don't need to.

In case of a select, the available options are already part of the form; they should be in $form[$field_name]['widget'] somewhere.
You could also try to use hook_options_list_alter().