function ldap_user_token_replace in Lightweight Directory Access Protocol (LDAP) 8.2
Same name and namespace in other branches
- 7.2 ldap_user/ldap_user.module \ldap_user_token_replace()
Parameters
array $account:
string $text:
Return value
string text with tokens replaced
1 call to ldap_user_token_replace()
- LdapUserUnitTests::testUnitTests in ldap_user/
tests/ ldap_user.test - make sure install succeeds and ldap user functions/methods work
File
- ldap_user/
ldap_user.module, line 1113 - Module for the LDAP User Entity
Code
function ldap_user_token_replace($token, $account, $entity = NULL) {
$desired_tokens = ldap_servers_token_tokens_needed_for_template($token);
$tokens = ldap_user_token_tokenize_entry($account, $desired_tokens, LDAP_SERVERS_TOKEN_PRE, LDAP_SERVERS_TOKEN_POST, $entity);
$result = str_replace(array_keys($tokens), array_values($tokens), $token);
return $result;
}