public function ProcessedText::buildText in YAML Form 8
Build an element as text element.
Parameters
array $element: An element.
array|mixed $value: A value.
array $options: An array of options.
Return value
array A render array representing an element as text.
Overrides YamlFormMarkupBase::buildText
File
- src/
Plugin/ YamlFormElement/ ProcessedText.php, line 41
Class
- ProcessedText
- Provides a 'processed_text' element.
Namespace
Drupal\yamlform\Plugin\YamlFormElementCode
public function buildText(array &$element, $value, array $options = []) {
// Copy to element so that we can render it without altering the actual
// $element.
$render_element = $element;
$html = (string) \Drupal::service('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, $value, $options);
}