0

I have created a custom entity type NOTE: it is based on an existing database structure and so ECK is not (according to Programming Drupal 7 Entities p. 84) able to deal with exposing an "existing database table[s] to Drupal".

I now need to create pages for users to create/edit/delete these entities themselves.

Surely there is something out there that allows me to just say "This is the entity type, this is the entity id, load all the columns in the database as $form fields and take care of it for me"?

EntityForm seems to me to want to make forms that are themselves entities.

entity_ui_get_form() seems to me to be about getting fieldable entities, but I'm trying to get the values as one can get by doing this...

$entity = entity_load('custom_entity', array($id));

...

$wrapper = entity_metadata_wrapper('custom_entity', $entity);

If this isn't something that can be done with only a few lines of code, what is the best approach? I got lost walking through the hook_menu() callbacks for node/add.

Thanks

1 Answer 1

0

As far as I can see, the Entity Creation Kit module provides these create/edit/delete forms out-of-the-box. Although you should probably redefine your entities with help of that module.

Otherwise, you can perhaps take a look at the ECK module source code and use the relevant parts for your custom module.

1
  • I'm using Programming Drupal 7 Entities and working through your advice, having no luck and returned to the book and just read "there's one thing ECK can't do at the time of writing - expose an existing database table to Drupal" my custom entities are based on existing database structures! Shame.
    – ja_him
    May 12, 2014 at 13:34

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.