function multifield_table_form_alter in Multifield table 7
Implements hook_form_alter().
File
- ./
multifield_table.module, line 167 - Provides a table formatter and widget for multifield field types.
Code
function multifield_table_form_alter(&$form, &$form_state, $form_id) {
// Host entity edit.
if (isset($form['#entity_type']) && isset($form['#bundle'])) {
foreach (field_info_instances($form['#entity_type'], $form['#bundle']) as $field_name => $instance) {
if (isset($form[$field_name]) && $instance['widget']['type'] == 'multifield_table') {
$language = $form[$field_name]['#language'];
$element =& $form[$field_name][$language];
if (isset($element['#cardinality']) && ($element['#cardinality'] > 1 || $element['#cardinality'] == FIELD_CARDINALITY_UNLIMITED)) {
$element['#theme'] = 'multifield_table_multiple_value_fields';
$element['#pre_render'][] = 'multifield_table_pre_render_multiple_fields';
}
}
}
}
}