You are here

function conditional_fields_set_required_field in Conditional Fields 6.2

Same name and namespace in other branches
  1. 6 conditional_fields.module \conditional_fields_set_required_field()

Marks as required a conditionally required form item and its descendants.

Since this function is called from a theme function, the item will appear required, but it won't be actually required.

See also

conditional_fields_custom_required_field()

1 call to conditional_fields_set_required_field()
theme_conditional_fields_form_item in ./conditional_fields.module
Prepares conditional fields for rendering and handles special cases. Note that if you modify the id and classes of these fields, you have to modify conditional_fields.js accordingly.

File

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

Code

function conditional_fields_set_required_field($item) {
  if (!empty($item['#conditional_fields_required'])) {
    $item['#required'] = TRUE;
  }
  foreach (element_children($item) as $child) {
    $item[$child] = conditional_fields_set_required_field($item[$child]);
  }
  return $item;
}