How to have no more than 20 Entity references to another content type? I have a content type with a entity reference to another content type/view. The current possible relations could be 1,2,3 .... until 10 or unlimited. These are given in the field attributes screens.

I need 20. After that the user is not allowed to add another field in the gui.

Any solutions how to do this?
You should select unlimited as possible relations. Then, using a custom module, you can alter the node edit form to don't allow more than 20 items.

To do this, implement hook form alter:

function mymodule_form_node_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  // do magic.
}


Inside you have to: 


Check the if the relations field has 20 item; if yes
delete the element widget that adds another one (so user don't get confused because it seems more items can be added).
Add a new validate handler to check related items are less than
21.