0

I'am on Drupal7 and wanto to reference this custom entity

function myentity_entity_info() {
  $info['myentity_basic'] = array(
    'label' => t('Ind (myentity)'),
    'controller class' => 'EntityAPIController',
    'views controller class' => 'EntityDefaultViewsController',
    'base table' => 'myentity_basic',
    'uri callback' => 'myentity_basic_uri',
    'fieldable' => TRUE,
    'entity keys' => array(
      'id' => 'basic_id' ,
      'bundle' => 'bundle_type',
    ),
    'bundle keys' => array(
      'bundle' => 'bundle_type',
    ),
    'static cache' => TRUE,
    'bundles' => array(
      'ind_bundle' => array(
        'label' => 'Ind bundle (myentity)',
        'admin' => array(
          'path' => 'admin/structure/myentity_basic/manage',
          'access arguments' => array('administer myentity_basic entities'),
        ),
      ),
    ),
    ),
  );

  return $info;
}

I am using an autocomplete field with data coming from an entityreference view and everything works as expected when saving the referencing entity but when I come to edit it again then the entity reference field in the form is not displaying fields (eg. name) from the myentity but just the basic_id between parenthesis.

basic_id

Problem is when I hit save, the reference to myentity gets lost.

What I am missing?

PS I have another reference field to user entity and it works just fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.