function token_render_array_value in Token 8
Same name and namespace in other branches
- 7 token.module \token_render_array_value()
Do not use this function yet. Its API has not been finalized.
1 call to token_render_array_value()
- token_tokens in ./
token.tokens.inc - Implements hook_tokens().
File
- ./
token.module, line 463 - Enhances the token API in core: adds a browseable UI, missing tokens, etc.
Code
function token_render_array_value($value, array $options = []) {
/** @var \Drupal\Core\Render\RendererInterface $renderer */
$renderer = \Drupal::service('renderer');
$rendered = is_array($value) ? $renderer
->renderPlain($value) : (string) $value;
return $rendered;
}