Return to Snippet

Revision: 3892
at September 30, 2007 09:13 by WimLeers


Initial Code
/**
 * 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;
}

Initial URL

                                

Initial Description

                                

Initial Title
Helper function to find a form element by reference

Initial Tags
textmate, drupal

Initial Language
PHP