public function ProcessedText::buildText in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Plugin/WebformElement/ProcessedText.php \Drupal\webform\Plugin\WebformElement\ProcessedText::buildText()
Build an element as text element.
Parameters
array $element: An element.
\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.
array $options: An array of options.
Return value
array A render array representing an element as text.
Overrides WebformMarkupBase::buildText
File
- src/
Plugin/ WebformElement/ ProcessedText.php, line 77
Class
- ProcessedText
- Provides a 'processed_text' element.
Namespace
Drupal\webform\Plugin\WebformElementCode
public function buildText(array $element, WebformSubmissionInterface $webform_submission, array $options = []) {
// Copy to element so that we can render it without altering the actual
// $element.
$render_element = $element;
$html = (string) $this->renderer
->renderPlain($render_element);
$element['#markup'] = MailFormatHelper::htmlToText($html);
// Must remove #type, #text, and #format.
unset($element['#type'], $element['#text'], $element['#format']);
return parent::buildText($element, $webform_submission, $options);
}