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