You are here

function ldap_help_parse_form in Lightweight Directory Access Protocol (LDAP) 7

Same name and namespace in other branches
  1. 8.2 ldap_help/ldap_help.status.inc \ldap_help_parse_form()
  2. 7.2 ldap_help/ldap_help.status.inc \ldap_help_parse_form()
2 calls to ldap_help_parse_form()
ldap_help_get_ldap_authentication in ldap_help/ldap_help.status.inc
ldap_help_get_ldap_authorization in ldap_help/ldap_help.status.inc

File

ldap_help/ldap_help.status.inc, line 412
status file for ldaphelp module

Code

function ldap_help_parse_form($form, $items) {
  $status = array();
  foreach ($form as $fieldset_name => $field) {
    foreach ($field as $field_name => $field_data) {
      if (isset($items[$fieldset_name][$field_name])) {
        $value = "";
        if (!@is_array($field_data['#default_value'])) {
          $default_value = @$field_data['#default_value'];
        }
        else {
          $default_value = join(', ', array_values($field_data['#default_value']));
        }
        switch ($field_data['#type']) {
          case 'radios':
            $value = $field_data['#options'][$default_value];
            break;
          case 'select':
          case 'checkboxes':
            $value = $default_value;
            break;
          case 'checkbox':
            $value = (bool) $field_data['#default_value'] ? 'y' : 'n';
            break;
          case 'hidden':
            $value = $field_data['#value'];
            break;
          case 'textarea':
          case 'textfield':
            $value = $default_value;
            break;
        }
        if ($items[$fieldset_name][$field_name] == 'empty') {
          $value = (bool) trim($value) ? 'populated' : 'empty';
        }
        $status[] = array(
          'title' => $field_name,
          'value' => $value,
        );
      }
    }
  }
  return $status;
}