You are here

function conditional_fields_unset_required_field in Conditional Fields 6

Unset the #required property and set a #required_field property for internal use.

2 calls to conditional_fields_unset_required_field()
conditional_fields_form_alter in ./conditional_fields.module
Implementation of hook_form_alter().
conditional_fields_node_editing_form in ./conditional_fields.module
Alteration of the node editing form

File

./conditional_fields.module, line 1104
Content fields and groups visibility based on the values of user defined 'trigger' fields.

Code

function conditional_fields_unset_required_field(&$field) {
  if ($field['#required']) {
    unset($field['#required']);
    $field['#required_field'] = TRUE;
  }
  foreach (element_children($field) as $child) {
    conditional_fields_unset_required_field($field[$child]);
  }
}