protected function TokenReplacer::getEntityIdFromTokenKey in Advanced Entity Tokens 2.x
Fetches an entity ID from a token key.
Parameters
string $token_key: The token key.
Return value
string The entity ID.
1 call to TokenReplacer::getEntityIdFromTokenKey()
- TokenReplacer::getReplacementsForTokenType in src/
TokenReplacer.php - Fetches token replacements for specific token types.
File
- src/
TokenReplacer.php, line 402
Class
- TokenReplacer
- Class TokenReplacer.
Namespace
Drupal\aetCode
protected function getEntityIdFromTokenKey(string $token_key) {
// The position of the first colon is used for both checking if a second
// part to the key exists and to separate between it (the first part) and
// the rest of the key.
$first_colon_pos = strpos($token_key, ':');
// The $first_key is the part of the key until the first colon if exist,
// or the full $token_key if no colon exists.
return $first_colon_pos ? substr($token_key, 0, $first_colon_pos) : $token_key;
}