function TypedDataResolver::getLabelByToken
Same name in other branches
- 8.x-3.x src/TypedDataResolver.php \Drupal\ctools\TypedDataResolver::getLabelByToken()
Provides an administrative label for a tokenized relationship.
Parameters
string $token: The token related to a context in the contexts array.
\Drupal\Core\Plugin\Context\ContextInterface[] $contexts: An array of contexts from which to extract our token's label.
Return value
\Drupal\Core\StringTranslation\TranslatableMarkup The administrative label of $token.
File
-
src/
TypedDataResolver.php, line 192
Class
- TypedDataResolver
- Typed Data Resolver Service.
Namespace
Drupal\ctoolsCode
public function getLabelByToken(string $token, array $contexts) {
// @todo Optimize this by allowing to limit the desired token?
$tokens = $this->getTokensForContexts($contexts);
if (isset($tokens[$token])) {
return $tokens[$token];
}
}