protected function WebformContact::formatHtmlItemValue in Webform 8.5
Same name and namespace in other branches
- 6.x src/Plugin/WebformElement/WebformContact.php \Drupal\webform\Plugin\WebformElement\WebformContact::formatHtmlItemValue()
Format composite element value into lines of text.
Parameters
array $element: An element.
\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.
array $options: An array of options.
Return value
array Composite element values converted into lines of html.
Overrides WebformCompositeBase::formatHtmlItemValue
File
- src/
Plugin/ WebformElement/ WebformContact.php, line 25
Class
- WebformContact
- Provides a 'contact' element.
Namespace
Drupal\webform\Plugin\WebformElementCode
protected function formatHtmlItemValue(array $element, WebformSubmissionInterface $webform_submission, array $options = []) {
$lines = $this
->formatTextItemValue($element, $webform_submission, $options);
if (!empty($lines['email'])) {
$lines['email'] = [
'#type' => 'link',
'#title' => $lines['email'],
'#url' => \Drupal::pathValidator()
->getUrlIfValid('mailto:' . $lines['email']),
];
}
return $lines;
}