function views_ui_pre_render_flatten_data in Views (for Drupal 7) 8.3
Same name and namespace in other branches
- 7.3 includes/admin.inc \views_ui_pre_render_flatten_data()
Flattens the structure of an element containing the #flatten property.
If a form element has #flatten = TRUE, then all of it's children get moved to the same level as the element itself. So $form['to_be_flattened'][$key] becomes $form[$key], and $form['to_be_flattened'] gets unset.
3 string references to 'views_ui_pre_render_flatten_data'
- FilterPluginBase::buildExposeForm in lib/
Drupal/ views/ Plugin/ views/ filter/ FilterPluginBase.php - Options form subform for exposed filter options.
- FilterPluginBase::build_group_form in lib/
Drupal/ views/ Plugin/ views/ filter/ FilterPluginBase.php - Build the form to let users create the group of exposed filters. This form is displayed when users click on button 'Build group'
- SortPluginBase::buildExposeForm in lib/
Drupal/ views/ Plugin/ views/ sort/ SortPluginBase.php - Form for exposed handler options.
File
- views_ui/
admin.inc, line 538 - Provides the Views' administrative interface.
Code
function views_ui_pre_render_flatten_data($form) {
foreach (element_children($form) as $key) {
$element = $form[$key];
if (!empty($element['#flatten'])) {
foreach (element_children($element) as $child_key) {
$form[$child_key] = $form[$key][$child_key];
}
// All done, remove the now-empty parent.
unset($form[$key]);
}
}
return $form;
}