protected function WebformComputedBase::formatTextItem in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Plugin/WebformElement/WebformComputedBase.php \Drupal\webform\Plugin\WebformElement\WebformComputedBase::formatTextItem()
Format an element's value as text.
Parameters
array $element: An element.
\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.
array $options: An array of options.
Return value
string The element's value formatted as text.
Overrides WebformElementBase::formatTextItem
See also
_webform_token_get_submission_value()
File
- src/
Plugin/ WebformElement/ WebformComputedBase.php, line 143
Class
- WebformComputedBase
- Provides a base class for 'webform_computed' elements.
Namespace
Drupal\webform\Plugin\WebformElementCode
protected function formatTextItem(array $element, WebformSubmissionInterface $webform_submission, array $options = []) {
$value = $this
->getValue($element, $webform_submission);
if ($this
->getMode($element) === WebformComputedBaseElement::MODE_HTML) {
return MailFormatHelper::htmlToText($value);
}
else {
return $value;
}
}