Entity Reference Autocomplete module: hook_entity_info definition? I have tested the Entity Reference Autocomplete module by defining a form field of type entityreference (via hook_form) on the user entity - and it works as advertised.

When I try it on my own entity an AJAX error is thrown.

My form element definition:

$form['name'] = array(
  '#title' =&gt; t('Ground'),
  '#type' =&gt; 'entityreference',
  '#era_entity_type' =&gt; 'ground',
  '#size' =&gt; 32,
);


I can't imagine the problem is my entity's base table. So, the only thing I can think of, which may be the source of the error, is my hook_entity_info definition:

/**
 * Implements hook_entity_info().
 */
function scorebook_entity_info() {
  $return = array(
    'ground' =&gt; array(
      'label' =&gt; t('Ground'),
      'controller class' =&gt; 'EntityAPIController',
      'base table' =&gt; 'scorebook_ground',
      'entity keys' =&gt; array('id' =&gt; 'grid'),
    ),
  );
  return $return;
}


It contains the minimum keys. Do I need to add some other keys to my definition? If anyone knows of a working example of this module working with a custom entity that may help too. Thanks.

UPDATE:

Here is the correct hook_entity_info definition for anyone who doesn't want to read everything below. You need to define an access callback function, also, to return either TRUE/FALSE accordingly.

'ground' =&gt; array(
  'label' =&gt; t('Ground'),
  'controller class' =&gt; 'EntityAPIController',
  'base table' =&gt; 'scorebook_ground',
  'entity keys' =&gt; array(
    'id' =&gt; 'grid',
    'label' =&gt; 'name',
  ),
  'access callback' =&gt; 'scorebook_access',
),
I'm the module maintainer. Thanks for using the module, hope you're finding it useful. You need to add a 'label' key to your entity definition, like:

'entity keys' =&gt; array(
  'id' =&gt; 'grid',
  'label' =&gt; 'table-column-that-contains-the-human-name-of-entity',
),


With that, and after flushing caches, etc, your form should work fine. The reason is that entityreference_autocomplete assumes that (as a best practice), every entity would have, apart of the ID, which will be normally just a number, some friendly way to identify it through a label. Therefore, you need that on your custom entity.

However, I get that not everyone might want / need that 'label' key or a column for the label in their schema, for whatever reason, and I've added support to the module to work without that. That bit is on the dev version on the module, and will be rolled out in the next stable version. So it's up to you, to define a column for the 'label' key in your schema, or download the dev version, or wait a  couple days for the stable release that supports entities without the 'label' key.

Cheers!