function entity_form in Entity API 7
Gets the edit form for any entity.
This helper makes use of drupal_get_form() and the regular form builder function of the entity type to retrieve and process the form as usual.
In order to use this helper to show an entity add form, the new entity object can be created via entity_create() or entity_property_values_create_entity().
Parameters
$entity_type: The type of the entity.
$entity: The entity to show the edit form for.
Return value
array|false The renderable array of the form. If there is no entity form or missing metadata, FALSE is returned.
See also
File
- ./
entity.module, line 695
Code
function entity_form($entity_type, $entity) {
$info = entity_get_info($entity_type);
if (isset($info['form callback'])) {
return $info['form callback']($entity, $entity_type);
}
elseif (entity_ui_controller($entity_type)) {
return entity_metadata_form_entity_ui($entity, $entity_type);
}
return FALSE;
}