public function WebformTokenManagerInterface::replaceNoRenderContext in Webform 6.x
Same name and namespace in other branches
- 8.5 src/WebformTokenManagerInterface.php \Drupal\webform\WebformTokenManagerInterface::replaceNoRenderContext()
Replace tokens in text with no render context.
This method allows tokens to be replaced when there is no render context via REST and JSON API requests.
Parameters
string|array $text: A string of text that may contain tokens.
\Drupal\Core\Entity\EntityInterface|null $entity: A Webform or Webform submission entity.
array $data: (optional) An array of keyed objects.
array $options: (optional) A keyed array of settings and flags to control the token replacement process. Supported options are:
- langcode: A language code to be used when generating locale-sensitive tokens.
- callback: A callback function that will be used to post-process the array of token replacements after they are generated.
- clear: A boolean flag indicating that tokens should be removed from the final text if no replacement value can be generated.
Return value
string|array Text or array with tokens replaced.
See also
\Drupal\Core\Utility\Token::replace
1 method overrides WebformTokenManagerInterface::replaceNoRenderContext()
- WebformTokenManager::replaceNoRenderContext in src/
WebformTokenManager.php - Replace tokens in text with no render context.
File
- src/
WebformTokenManagerInterface.php, line 69
Class
- WebformTokenManagerInterface
- Defines an interface for token manager classes.
Namespace
Drupal\webformCode
public function replaceNoRenderContext($text, EntityInterface $entity = NULL, array $data = [], array $options = []);