function fieldgroup_display_overview_form_submit in Content Construction Kit (CCK) 6.3
Same name and namespace in other branches
- 5 fieldgroup.module \fieldgroup_display_overview_form_submit()
- 6 modules/fieldgroup/fieldgroup.module \fieldgroup_display_overview_form_submit()
- 6.2 modules/fieldgroup/fieldgroup.module \fieldgroup_display_overview_form_submit()
1 string reference to 'fieldgroup_display_overview_form_submit'
- fieldgroup_form_alter in modules/
fieldgroup/ fieldgroup.module - Implementation of hook_form_alter()
File
- modules/
fieldgroup/ fieldgroup.module, line 687 - Create field groups for CCK fields.
Code
function fieldgroup_display_overview_form_submit($form, &$form_state) {
$form_values = $form_state['values'];
$groups = fieldgroup_groups($form['#type_name']);
foreach ($form_values as $key => $values) {
if (in_array($key, $form['#groups'])) {
$group = $groups[$key];
// Multigroup data (namely, subgroup data) ends up in the settings array as well
// Prevent this data from ending up inside of ['settings']['display']
if (is_array($values['settings']) && array_key_exists('multigroup', $values['settings'])) {
if (is_array($group['settings']['multigroup'])) {
foreach ($values['settings']['multigroup'] as $group_key => $group_values) {
$group['settings']['multigroup'][$group_key] = $values['settings']['multigroup'][$group_key];
}
}
else {
$group['settings']['multigroup'] = $values['settings']['multigroup'];
}
unset($values['settings']['multigroup']);
}
// We have some numeric keys here, so we can't use array_merge.
$group['settings']['display'] = $values + $group['settings']['display'];
fieldgroup_save_group($form['#type_name'], $group);
}
}
}