You are here

function _cas_ldap_token_values in CAS Attributes 6.3

Implements hook_token_values.

1 call to _cas_ldap_token_values()
cas_ldap_token_values in ./cas_ldap.module
Implements hook_token_values().

File

./cas_ldap.tokens.inc, line 25
Token module integration.

Code

function _cas_ldap_token_values($type, $object = NULL) {
  $values = array();
  if ($type == 'cas' && !empty($object)) {
    $cas = $object;
    $attributes = cas_ldap_attributes($cas);
    foreach ($attributes as $key => $value) {
      if (is_array($value)) {
        $value = $value[0];
      }
      $values['cas-ldap-' . $key] = check_plain($value);

      // $values['cas-attribute-' . $key . '-raw'] = $value;
    }
    $keys = array_keys($attributes);
    $values['cas-ldap-?'] = t('Available attributes: %keys', array(
      '%keys' => implode(', ', $keys),
    ));

    // $values['cas-ldap-?-raw'] = $values['cas-attribute-?'];
  }
  return $values;
}