function form_builder_field_configure_pre_render in Form Builder 7.2
Same name and namespace in other branches
- 6 includes/form_builder.admin.inc \form_builder_field_configure_pre_render()
- 7 includes/form_builder.admin.inc \form_builder_field_configure_pre_render()
Pre-render function for the field configuration form.
1 call to form_builder_field_configure_pre_render()
- AdminTest::testChangingGroupsInElement in tests/
AdminTest.php - Test: Elements can change the tabs displayed on their configure form.
1 string reference to 'form_builder_field_configure_pre_render'
- form_builder_field_configure in includes/
form_builder.admin.inc - Form for editing a field.
File
- includes/
form_builder.admin.inc, line 618 - form_builder.admin.inc Administrative interface for editing forms.
Code
function form_builder_field_configure_pre_render($form) {
$groups = $form['#property_groups'];
foreach (element_children($form) as $key) {
// If no group is specified, put the element into the default group.
if (!isset($form[$key]['#form_builder']['property_group']) || !isset($groups[$form[$key]['#form_builder']['property_group']])) {
if (!isset($form[$key]['#type']) || isset($form[$key]['#type']) && !in_array($form[$key]['#type'], array(
'hidden',
'button',
'submit',
'value',
'token',
))) {
$form[$key]['#form_builder']['property_group'] = 'default';
}
}
if (isset($form[$key]['#form_builder']['property_group'])) {
$group = $form[$key]['#form_builder']['property_group'];
// We add "_property_group" to the field key to prevent conflicts of
// property names and group names.
if (!isset($form[$group . '_property_group'])) {
$form[$group . '_property_group'] = array(
'#type' => 'fieldset',
'#title' => $groups[$group]['title'],
'#weight' => $groups[$group]['weight'],
'#collapsible' => isset($groups[$group]['collapsible']) ? $groups[$group]['collapsible'] : FALSE,
'#collapsed' => isset($groups[$group]['collapsed']) ? $groups[$group]['collapsed'] : FALSE,
'#attributes' => array(
'class' => array(
'form-builder-group',
),
),
);
}
$form[$group . '_property_group'][$key] = $form[$key];
unset($form[$key]);
}
}
return $form;
}