protected function WebformHandlerBase::replaceTokens in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Plugin/WebformHandlerBase.php \Drupal\webform\Plugin\WebformHandlerBase::replaceTokens()
Replace tokens in text with no render context.
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.
10 calls to WebformHandlerBase::replaceTokens()
- ActionWebformHandler::executeAction in src/
Plugin/ WebformHandler/ ActionWebformHandler.php - Execute this action.
- EmailWebformHandler::getMessage in src/
Plugin/ WebformHandler/ EmailWebformHandler.php - Get a fully populated email for a webform submission.
- EmailWebformHandler::getMessageEmails in src/
Plugin/ WebformHandler/ EmailWebformHandler.php - Get message to, cc, bcc, and from email addresses.
- EmailWebformHandler::sendMessage in src/
Plugin/ WebformHandler/ EmailWebformHandler.php - Sends and logs a webform submission message.
- ExampleWebformHandler::confirmForm in modules/
webform_example_handler/ src/ Plugin/ WebformHandler/ ExampleWebformHandler.php - Confirm webform submission form.
File
- src/
Plugin/ WebformHandlerBase.php, line 746
Class
- WebformHandlerBase
- Provides a base class for a webform handler.
Namespace
Drupal\webform\PluginCode
protected function replaceTokens($text, EntityInterface $entity = NULL, array $data = [], array $options = []) {
return $this->tokenManager
->replaceNoRenderContext($text, $entity, $data, $options);
}