public function WebformMapping::formatTableColumn in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Plugin/WebformElement/WebformMapping.php \Drupal\webform\Plugin\WebformElement\WebformMapping::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/ WebformMapping.php, line 331
Class
- WebformMapping
- Provides a 'mapping' element.
Namespace
Drupal\webform\Plugin\WebformElementCode
public function formatTableColumn(array $element, WebformSubmissionInterface $webform_submission, array $options = []) {
if (isset($options['source_key'])) {
$source_key = $options['source_key'];
$value = $this
->getValue($element, $webform_submission);
$question_value = isset($value[$source_key]) ? $value[$source_key] : '';
return isset($element['#destination']) ? WebformOptionsHelper::getOptionText($question_value, $element['#destination']) : NULL;
}
else {
return $this
->formatHtml($element, $webform_submission);
}
}