function _makemeeting_rebuild_parents in Make Meeting Scheduler 7.2
Helper function to update the form elements parents. This is required for the element to be saved properly by the Field API (see #process)
Parameters
$element:
Return value
mixed
1 string reference to '_makemeeting_rebuild_parents'
- makemeeting_field_widget_form in ./
makemeeting.field.inc - Implements hook_field_widget_form().
File
- ./
makemeeting.field.inc, line 315 - This file is mostly about the field configuration.
Code
function _makemeeting_rebuild_parents(&$element) {
$parents = array_diff($element['#array_parents'], $element['#parents']);
$elements = array(
'makemeeting_more_choices',
'makemeeting_more_suggestions',
'makemeeting_copy_suggestions',
);
foreach ($elements as $e) {
$element[$e]['#parents'] = $parents;
if (isset($element[$e]['#limit_validation_errors'])) {
$element[$e]['#limit_validation_errors'][0] = array_merge($parents, $element[$e]['#limit_validation_errors'][0]);
}
}
$element['makemeeting_more_suggestions']['#parents'] = $parents;
$element['makemeeting_copy_suggestions']['#parents'] = $parents;
foreach (element_children($element['choices']) as $key1) {
foreach (element_children($element['choices'][$key1]) as $key2) {
$keys = element_children($element['choices'][$key1][$key2]);
if (empty($keys)) {
$element['choices'][$key1][$key2]['#parents'] = array_merge($parents, $element['choices'][$key1][$key2]['#parents']);
}
else {
foreach ($keys as $key3) {
$element['choices'][$key1][$key2][$key3]['#parents'] = array_merge($parents, $element['choices'][$key1][$key2][$key3]['#parents']);
}
}
}
}
return $element;
}