Entity Reference. Hide not user referenced terms in node form? This is my 2nd question about my problem, the last was "Users have access to add Commerce Products into the Store and publish it. How to display to user only allowed firms in the product addition form?"
 I am writing my 6th module and I do not know nothing about form fields arrays.
I need to display in node addition form only user referenced terms in field Firms.
Taxonomy "Firms" has field_seller of type Entity Reference. I add to all Firms terms users that must have access to them. How can I display to user only those terms that have reference to this user when he add node Product ?
I've made this code that has only correct name (I've checked this with other funcions that was in it and worked):

/* Displays only terms that have Entity Reference field with current user reference */
function user_referenced_taxonomy_terms_form_node_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  //$form['field_firm']
}


how to get array $form['field_firm'] of terms that have reference to current user if the user role is not admin?
I solved this task with my module:
This code limit radiobuttons of field_firm on the node addition page with only those terms that have entity reference to current user. Admin have access to all. If user has no one term access field Firms hides.

/* BASE_FORM_ID : node_form */
/* Displays only terms that have Entity Reference field with current user reference */
//$form['field_firm']['und'][1551]= array('#access' =&gt; FALSE); //hides taxonomy term 1551

function user_referenced_taxonomy_terms_form_node_form_alter(&amp;$form, &amp;$form_state, $form_id) {

  global $user;
  //if current user has roles administrator or editor return
  foreach ($user-&gt;roles as $role) {
      if (($role == 'administrator') || ($role == 'editor')) return;
  }
  if (isset($form['field_firm'])) {
    $query = new EntityFieldQuery();
    $term_entities = $query
      -&gt;entityCondition('bundle', 'firms')
      -&gt;entityCondition('entity_type', 'taxonomy_term', '=')
      -&gt;fieldCondition('field_seller','target_id',$user-&gt;uid) // if user has access
      -&gt;execute();
    if ($term_entities) {
        //forming array of firms using $term_entities array
         $items = array_keys($term_entities['taxonomy_term']);
         foreach ($form['field_firm']['und']['#options'] as $key=&gt;$value) {
             if ($key == '_none') continue;
             $delete=true;
             for ($i=0;$i&lt;count($items);$i++) {
                 if ($key == $items[$i])  $delete = FALSE;
             }
             if ($delete) $form['field_firm']['und'][$key]= array('#access' =&gt; FALSE);
         }
    }else {
        //hide field firm if user has no access to any term
        $form['field_firm']['#access'] = FALSE;
    } 
  }
}