You are here

function _msnf_element_unset_required in Multistep Nodeform 7

Helper method to make an element and all its children optional.

Parameters

<array> $element: The element to make optional.

<int> $depth: Maximum depth of children to process. Internally used.

1 call to _msnf_element_unset_required()
_msnf_hide_fields in ./msnf.module
Hide all fields that are not associated to the current step.

File

./msnf.module, line 1349
Main functions for module "Multistep Nodeform".

Code

function _msnf_element_unset_required(&$element, $depth = 10) {
  if (isset($element['#required'])) {
    $element['#required'] = FALSE;
  }
  if ($depth <= 0) {

    // Make sure we do not recurse forever.
    return;
  }
  foreach (element_children($element) as $key) {
    _msnf_element_unset_required($element[$key], --$depth);
  }
}