You are here

public function WebformCompositeBase::formatTableColumn in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformElement/WebformCompositeBase.php \Drupal\webform\Plugin\WebformElement\WebformCompositeBase::formatTableColumn()

Format an element's table column value.

Parameters

array $element: An element.

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.

array $options: An array of options returned from ::getTableColumns().

Return value

array|string The element's value formatted as an HTML string or a render array.

Overrides WebformElementBase::formatTableColumn

File

src/Plugin/WebformElement/WebformCompositeBase.php, line 232

Class

WebformCompositeBase
Provides a base for composite elements.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function formatTableColumn(array $element, WebformSubmissionInterface $webform_submission, array $options = []) {
  if (isset($options['composite_key']) && isset($options['composite_element'])) {
    $composite_element = $options['composite_element'];
    $composite_element['#webform_key'] = $element['#webform_key'];
    return $this->elementManager
      ->invokeMethod('formatHtml', $composite_element, $webform_submission, $options);
  }
  else {
    return $this
      ->formatHtml($element, $webform_submission);
  }
}