public static function WebformComputedToken::computeValue in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Element/WebformComputedToken.php \Drupal\webform\Element\WebformComputedToken::computeValue()
Compute value.
Parameters
array $element: An element.
\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.
Return value
string The computed value.
Overrides WebformComputedBase::computeValue
File
- src/
Element/ WebformComputedToken.php, line 17
Class
- WebformComputedToken
- Provides an item to display computed webform submission values using tokens.
Namespace
Drupal\webform\ElementCode
public static function computeValue(array $element, WebformSubmissionInterface $webform_submission) {
$mode = static::getMode($element);
/** @var \Drupal\webform\WebformTokenManagerInterface $token_manager */
$token_manager = \Drupal::service('webform.token_manager');
// Replace tokens in value.
return $token_manager
->replace($element['#template'], $webform_submission, [], [
'html' => $mode === WebformComputedInterface::MODE_HTML,
]);
}