1 views_handler_filter.inc | views_handler_filter::build_group_submit($form, &$form_state) |
Save new group items, re-enumerates and remove groups marked to delete.
File
- core/
modules/ views/ handlers/ views_handler_filter.inc, line 648 - @todo.
Class
- views_handler_filter
- Base class for filters.
Code
function build_group_submit($form, &$form_state) {
$groups = array();
backdrop_sort($form_state['values']['options']['group_info']['group_items']);
// Filter out removed items.
// Start from 1 to avoid problems with #default_value in the widget.
$new_id = 1;
$new_default = 'All';
foreach ($form_state['values']['options']['group_info']['group_items'] as $id => $group) {
if (empty($group['remove'])) {
// Don't store this.
unset($group['remove']);
unset($group['weight']);
$groups[$new_id] = $group;
if ($form_state['values']['options']['group_info']['default_group'] === $id) {
$new_default = $new_id;
}
}
$new_id++;
}
if ($new_default != 'All') {
$form_state['values']['options']['group_info']['default_group'] = $new_default;
}
$filter_default_multiple = array_filter($form_state['values']['options']['group_info']['default_group_multiple']);
$form_state['values']['options']['group_info']['default_group_multiple'] = $filter_default_multiple;
$form_state['values']['options']['group_info']['group_items'] = $groups;
}