What is the reason that the _msnf_element_unset_required() function uses $depth to limit the number of recursions?

Seems like that would make it possible to miss some elements, plus even without the depth the function should not recurse forever, it will only recurse until there are no more children.

I would think it should be like this:

<?php
function _msnf_element_unset_required(&$element) {
  foreach (element_children($element) as $key) {
    _msnf_element_unset_required($element[$key]);
  }
  if (isset($element['#required'])) {
    $element['#required'] = FALSE;
  }
}
?>

Comments

rooby’s picture

Same goes for _msnf_fieldgroup_has_element()