protected function WebformCompositeBase::formatTextItem in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Plugin/WebformElement/WebformCompositeBase.php \Drupal\webform\Plugin\WebformElement\WebformCompositeBase::formatTextItem()
Format an element's value as text.
Parameters
array $element: An element.
\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.
array $options: An array of options.
Return value
string The element's value formatted as text.
Overrides WebformElementBase::formatTextItem
See also
_webform_token_get_submission_value()
1 call to WebformCompositeBase::formatTextItem()
- Address::formatTextItem in src/
Plugin/ WebformElement/ Address.php - Format an element's value as text.
1 method overrides WebformCompositeBase::formatTextItem()
- Address::formatTextItem in src/
Plugin/ WebformElement/ Address.php - Format an element's value as text.
File
- src/
Plugin/ WebformElement/ WebformCompositeBase.php, line 494
Class
- WebformCompositeBase
- Provides a base for composite elements.
Namespace
Drupal\webform\Plugin\WebformElementCode
protected function formatTextItem(array $element, WebformSubmissionInterface $webform_submission, array $options = []) {
if (!$this
->hasValue($element, $webform_submission, $options)) {
return '';
}
$format = $this
->getItemFormat($element);
// Handle custom composite text items.
if ($format === 'custom' && !empty($element['#format_text'])) {
return $this
->formatCustomItem('text', $element, $webform_submission, $options);
}
switch ($format) {
case 'list':
case 'raw':
$lines = $this
->formatCompositeTextItems($element, $webform_submission, $options);
return implode(PHP_EOL, $lines);
default:
$lines = $this
->formatTextItemValue($element, $webform_submission, $options);
return implode(PHP_EOL, $lines);
}
}