function microdata_bundle_mapping_form in Microdata 7
Form builder helper function.
Creates the full bundle mapping form, including fields, for Microdata's custom UI.
1 string reference to 'microdata_bundle_mapping_form'
- microdata_ajax_bundle_mapping in ./
microdata.admin.inc - A modal callback for bundle mapping.
File
- ./
microdata.admin.inc, line 141 - Microdata administration and module settings UI.
Code
function microdata_bundle_mapping_form($form, &$form_state) {
$entity_type = $form_state['#entity_type'];
$bundle_type = $form_state['#bundle_type'];
$mapping = microdata_get_mapping($entity_type, $bundle_type);
$form['microdata'] = array(
'#type' => 'container',
'#tree' => TRUE,
);
$form['microdata'][$entity_type] = microdata_get_bundle_type_mapping_form($mapping, $entity_type, $bundle_type);
foreach (field_info_instances($entity_type, $bundle_type) as $field_name => $instance) {
$form['microdata']['fields'][$field_name] = microdata_get_instance_mapping_form($field_name, $instance);
$form['microdata']['fields'][$field_name]['#type'] = 'fieldset';
$form['microdata']['fields'][$field_name]['#title'] = check_plain($instance['label']);
}
// Add submit.
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#weight' => 5,
'#submit' => array(
'microdata_bundle_type_mapping_form_submit',
'microdata_form_field_ui_field_edit_form_submit',
),
);
return $form;
}