Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
rooby CreditAttribution: rooby commentedSame goes for _msnf_fieldgroup_has_element()