You are here

protected function Address::formatHtmlItem in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/Address.php \Drupal\webform\Plugin\WebformElement\Address::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 WebformCompositeBase::formatHtmlItem

File

src/Plugin/WebformElement/Address.php, line 235

Class

Address
Provides a 'address' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

protected function formatHtmlItem(array $element, WebformSubmissionInterface $webform_submission, array $options = []) {
  $format = $this
    ->getItemFormat($element);
  if ($format === 'value') {
    return $this
      ->buildAddress($element, $webform_submission, $options);
  }
  else {
    return parent::formatHtmlItem($element, $webform_submission, $options);
  }
}