You are here

function entity_ui_get_bundle_add_form in Entity API 7

Page callback to add an entity of a specific bundle.

Parameters

$entity_type: The type of the entity.

$bundle_name: The bundle machine name.

1 string reference to 'entity_ui_get_bundle_add_form'
EntityBundleableUIController::hook_menu in includes/entity.ui.inc
Provides definitions for implementing hook_menu().

File

./entity.module, line 155

Code

function entity_ui_get_bundle_add_form($entity_type, $bundle_name) {
  $info = entity_get_info($entity_type);
  $bundle_key = $info['entity keys']['bundle'];

  // Make a stub entity of the right bundle to pass to the entity_ui_get_form().
  $values = array(
    $bundle_key => $bundle_name,
  );
  $entity = entity_create($entity_type, $values);
  return entity_ui_get_form($entity_type, $entity, 'add');
}