How to get the list of all entity reference fields and their params? I'm trying to build a new widget for the entity reference module.
(nested checkboxes = tree according to entity references between nodes)

The only answer I'm looking for is :
"How to get the list of all entity reference fields and their params? (child and parent node)

Thank you for your help!

Ludovic

Edit : working on D7
Here is my custom function that gets id's of all files referenced entities and their parents. Also get's all field names, entity types and bundles of entityreference fields.

function _my_module_get_entityreferences_settings() {
  $child_ids = $field_names = $settings = array();

  // Get all entityreference field names
  $query = db_select('field_config', 'f');
  $query-&gt;fields('f', array('field_name'));
  $query-&gt;condition('f.type', 'entityreference');
  $query-&gt;distinct();
  $rows = $query-&gt;execute();

  foreach ($rows as $row) {
    $field_name = $row-&gt;field_name;
    $field_names[] = $field_name;
  }

  // Loop all entityreference fields. Get all child and parent Ids
  foreach ($field_names as $field_name) {
    $table = 'field_data_' . $field_name;
    $target_id = $field_name . '_target_id';

    $query = db_select($table, 'f');
    $query-&gt;fields('f', array('entity_id', $target_id, 'entity_type', 'bundle'));
    $query-&gt;distinct();
    $rows = $query-&gt;execute();

    foreach ($rows as $row) {
      $settings[$row-&gt;entity_type][$row-&gt;bundle][$field_name] = $field_name;
      $child_ids[$row-&gt;{$target_id}] = array(
        'id' =&gt; $row-&gt;{$target_id},
        'parent' =&gt; $row-&gt;entity_id,
      );
    }
  }

  return array(
    'childs' =&gt; $child_ids,
    'settings' =&gt; $settings,
  );
}


Maybe you don't need all this stuff. When you get $field_names array you can use

$field = field_info_field($field_name);


to get settings of current field. You can find here referenced bundles, field type, handler_settings etc.