You are here

function _ldapdata_attribute_form in LDAP integration 6

Same name and namespace in other branches
  1. 5.2 ldapdata.module \_ldapdata_attribute_form()
  2. 5 ldapdata.module \_ldapdata_attribute_form()

Create HTML form element for the writtable LDAP attribute.

Parameters

$value: A current value in LDAP.

$info: An array with the HTML from element definitions.

Return value

An array of the form element.

1 call to _ldapdata_attribute_form()
_ldapdata_user_form in ./ldapdata.module
Implements hook_user() categories operation. Only used for editable LDAP attributes with no Drupal equivalents.

File

./ldapdata.module, line 679
ldapdata provides data maping against ldap server.

Code

function _ldapdata_attribute_form($value, $info) {
  switch (array_shift($info)) {
    case 'textfield':
      $form = array(
        '#type' => 'textfield',
        '#title' => check_plain(array_shift($info)),
        '#default_value' => $value,
        '#size' => array_shift($info),
        '#maxlength' => array_shift($info),
        '#description' => check_plain(array_shift($info)),
        '#attributes' => array_shift($info),
        '#required' => array_shift($info),
      );
      break;
    case 'password':
      $form = array(
        '#type' => 'password',
        '#title' => check_plain(array_shift($info)),
        '#default_value' => $value,
        '#size' => array_shift($info),
        '#maxlength' => array_shift($info),
        '#description' => check_plain(array_shift($info)),
      );
      break;
  }
  return $form;
}