/**
* Helper function to find a form element by reference.
*/
function _find_element(&$element, $element_name, &$form_element) {
if (isset($element[$element_name])) {
$form_element = $element[$element_name];
return TRUE;
}
else {
foreach ($element as $key => $value) {
if (is_array($element[$key])) {
$found = _find_element(&$element[$key], $element_name, &$form_element);
if ($found) {
return TRUE;
}
}
}
}
return FALSE;
}