You are here

function conditional_fields_set_required_for_render in Conditional Fields 5

Recursive function to set required for all conditionally required fields. This causes Drupal to render conditionally required fields in a way that indicates they are required when visible. e.g., with an asterisk.

1 call to conditional_fields_set_required_for_render()
theme_conditional_fields_form_item in ./conditional_fields.module
Themes the wrappers around conditional fields. 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 872

Code

function conditional_fields_set_required_for_render($item) {
  if ($item['#required_field']) {
    $item['#required'] = TRUE;
  }
  else {
    foreach (element_children($item) as $child) {
      conditional_fields_set_required_for_render($item[$child]);
    }
  }
}