You are here

public function TokenProcessor::tokenizeUserAccount in Lightweight Directory Access Protocol (LDAP) 8.3

Tokenize a user account.

Parameters

\Drupal\user\UserInterface $account: The Drupal user account.

array $token_keys: Keys for tokens: 'all' signifies return all token/value pairs available; otherwise array lists token keys (e.g. property.name ...NOT [property.name])

string $pre: Prefix of token.

string $post: Suffix of token.

Return value

array Should return token/value pairs in array such as 'status' => 1, 'uid' => 17.

1 call to TokenProcessor::tokenizeUserAccount()
TokenProcessor::tokenReplace in ldap_servers/src/Processor/TokenProcessor.php
Replace a token.

File

ldap_servers/src/Processor/TokenProcessor.php, line 182

Class

TokenProcessor
Helper to manage LDAP tokens and process their content.

Namespace

Drupal\ldap_servers\Processor

Code

public function tokenizeUserAccount(UserInterface $account, array $token_keys = [], $pre = self::PREFIX, $post = self::SUFFIX) {
  if (empty($token_keys)) {
    $token_keys = $this
      ->discoverUserAttributes($account);
  }
  $tokens = [];
  foreach ($token_keys as $token_key) {
    $tokens = array_merge($tokens, $this
      ->fetchSingleToken($account, $pre, $post, $token_key));
  }
  return $tokens;
}