You are here

function _fc_field_attach_ids in Field Complete 7

1 call to _fc_field_attach_ids()
_fc_field_attach_after_build in ./fc.form.inc

File

./fc.form.inc, line 147
Field Complete - Provides field-based completeness for any entity - admin.

Code

function _fc_field_attach_ids(&$element, $depth = 0) {

  // Decide whether we should tag this element or sub-element as field complete.
  $element['#field_complete'] = $depth == 0 || $depth > 0 && !empty($element['#type']) && !in_array($element['#type'], array(
    'radio',
    'checkbox',
  ));
  $keys = element_children($element);
  if (!empty($keys)) {
    foreach ($keys as $key) {
      _fc_field_attach_ids($element[$key], $depth + 1);
    }
    $element['#field_complete'] = TRUE;
    if (!empty($element['#type']) && $element['#type'] == 'radios') {
      unset($element['_none']);
    }
  }
  else {
    fc_add_id($element['#id']);
  }
}