function flexiform_add_for_entity in Flexiform 7
Form wrapper to add a flexiform for a given entity type and bundle.
1 string reference to 'flexiform_add_for_entity'
- FlexiformUIController::hook_menu in ./
flexiform.admin.inc - Overrides hook_menu() defaults.
File
- ./
flexiform.admin.inc, line 391 - Model type editing UI.
Code
function flexiform_add_for_entity($entity_type, $bundle) {
$bundle = field_extract_bundle($entity_type, $bundle);
$values = array(
'base_entity' => $entity_type,
'base_entity_bundle' => $bundle,
);
$flexiform = entity_create('flexiform', $values);
$info = entity_get_info($entity_type);
if (!empty($info['bundles'][$bundle]['admin']['real path'])) {
$form_state['redirect'] = $info['bundles'][$bundle]['admin']['real path'] . '/forms';
}
// Fix the entity and bundle.
$form_state['fix_entity_bundle'] = TRUE;
return entity_ui_get_form('flexiform', $flexiform, 'add', $form_state);
}