Pulling Possible Select Values From A Field (Drupal 7) I have been looking if there is a function that return all the possible values for a field. I have a select field that is a Node Ref. So, function list_allowed_values() is out of the question. Because, list_allowed_values() is not compatible with Node Ref. Does anyone know a function to get all the possible Node Ref for a field?

Or do have to code my own function?
Thanks,
Nate
Ok, I did some digger on google. ychaugule made a nice function for this problem. Here is the post.
Also, reference to the information here:

"But the above code will only work for select list, not for node reference or other types of references. _field_allowed_values() function is a custom function which returns allowed values of reference type field. The function returns allowed values for node reference and term reference field and can be extended to get allowed values of other reference fields as well. - See more at: http://yogeshchaugule.com/blog/2013/get-allowed-values-select-list-field#sthash.xnf89Cgn.dpuf"

&lt;?php
function _field_allowed_values($field_name) {
      // retrieve field configurations from DB.
  $allowed_values = array();
  $query = db_select('field_config');
  $query-&gt;condition('field_name',$field_name)
  -&gt;fields('field_config',array('type', 'data'));


  $result = $query-&gt;execute()-&gt;fetchAssoc();


// Allowed references type
  $ref_type = array(
    'node_reference',
    'taxonomy_term_reference',
    );


  $field_config = unserialize($result['data']);
  if (in_array($result['type'], $ref_type)) {
    if ($result['type'] == 'node_reference') {
      $node_types = array_filter($field_config['settings']['referenceable_types']);


      $query = db_select('node');
      $query-&gt;condition('type', $node_types, 'in')
      -&gt;condition('status', 1)
      -&gt;fields('node', array('nid', 'title'));
      $allowed_values = $query-&gt;execute()-&gt;fetchAllKeyed(0, 1);
    }
    elseif ($result['type'] == 'taxonomy_term_reference') {
      $allowed_values = taxonomy_allowed_values($field_config);
    }
  }
  else {
    $allowed_values_raw = unserialize($result['data']);
    $allowed_values = (!empty($allowed_values_raw['settings']['allowed_values']) ? $allowed_values_raw['settings']['allowed_values'] : array());
  }
  return

  $allowed_values;
}


$field = _field_allowed_values('FIELD_NAME');