function flexiform_ui_get_clone_form in Flexiform 7
Clone form page callback.
1 string reference to 'flexiform_ui_get_clone_form'
- FlexiformUIController::hook_menu in ./
flexiform.admin.inc - Overrides hook_menu() defaults.
File
- ./
flexiform.admin.inc, line 2182 - Model type editing UI.
Code
function flexiform_ui_get_clone_form($entity_type, $entity, $op = 'clone', $form_state = array()) {
$form_id = 'flexiform_form';
// Do not use drupal_get_form(), but invoke drupal_build_form() ourself so
// we can prepulate the form state.
$form_state['wrapper_callback'] = 'entity_ui_main_form_defaults';
$form_state['entity_type'] = 'flexiform';
form_load_include($form_state, 'inc', 'entity', 'includes/entity.ui');
$entity = clone $entity;
$entity->id = FALSE;
$entity->cloned_from = $entity->form;
$entity->form = FALSE;
$entity->is_new = TRUE;
$entity->status = ENTITY_CUSTOM;
// We don't pass the entity type as first parameter, as the implementing
// module knows the type anyway. However, in order to allow for efficient
// hook_forms() implementiations we append the entity type as last argument,
// which the module implementing the form constructor may safely ignore.
// @see entity_forms()
$form_state['build_info']['args'] = array(
$entity,
$op,
$entity_type,
);
return drupal_build_form($form_id, $form_state);
}