You are here

public function Token::getTokenInfo in Token 8

Returns metadata describing supported a token.

Parameters

$token_type: The token type for which the metadata is required.

$token: The token name for which the metadata is required.

Return value

array[] An array of information from hook_token_info() for the specified token.

Overrides TokenInterface::getTokenInfo

See also

hook_token_info()

hook_token_info_alter()

File

src/Token.php, line 97

Class

Token
Service to retrieve token information.

Namespace

Drupal\token

Code

public function getTokenInfo($token_type, $token) {
  if (empty($this->tokenInfo)) {
    $this
      ->getInfo();
  }
  return isset($this->tokenInfo['tokens'][$token_type][$token]) ? $this->tokenInfo['tokens'][$token_type][$token] : NULL;
}