My comment from #1196456-12: provide a harmonized entity_form() function:

entity_form() is supposed to build and process the form for you - there is no possibility to embed forms in others or similar. That way there is no point or possibility to customize $form and $form_state.

This prevents entity_form from being used in ctools modals. That needs a custom form_state.
A possible workaround for that is entity_metadata_form_id_* to complement entity_metadata_form_*.

function entity_metadata_form_id_node(&$form, &$form_state, $node) {
  // Pre-populate the form-state with the right form include.
  $form_state['build_info']['args'] = array($node);
  form_load_include($form_state, 'inc', 'node', 'node.pages');
  return $node->type . '_node_form';
function entity_metadata_form_node(&$form, &$form_state, $node) {
  $form_id = entity_metadata_form_id_node($form, $form_state, $node);
  return drupal_build_form($form_id, $form_state);

Unsure about the &$form part, but this would really help with the ctools modal stuff.

fago's response:

Well we could add an optional parameter $form_state to entity_form() what allows prepopulating it that way.


Any news on this?