protected function WebformCompositeBase::formatComposite in Webform 8.5
Same name and namespace in other branches
- 6.x src/Plugin/WebformElement/WebformCompositeBase.php \Drupal\webform\Plugin\WebformElement\WebformCompositeBase::formatComposite()
Format a composite's sub element's value as HTML or plain text.
Parameters
string $type: The format type, HTML or Text.
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 plain text or a render array.
2 calls to WebformCompositeBase::formatComposite()
- WebformCompositeBase::formatCompositeHtml in src/
Plugin/ WebformElement/ WebformCompositeBase.php - Format a composite's sub element's value as HTML.
- WebformCompositeBase::formatCompositeText in src/
Plugin/ WebformElement/ WebformCompositeBase.php - Format a composite's sub element's value as plain text.
File
- src/
Plugin/ WebformElement/ WebformCompositeBase.php, line 596
Class
- WebformCompositeBase
- Provides a base for composite elements.
Namespace
Drupal\webform\Plugin\WebformElementCode
protected function formatComposite($type, array $element, WebformSubmissionInterface $webform_submission, array $options = []) {
$options['webform_key'] = $element['#webform_key'];
$composite_element = $this
->getInitializedCompositeElement($element, $options['composite_key']);
$composite_plugin = $this->elementManager
->getElementInstance($composite_element);
// Exclude attachments for composite element.
// @see \Drupal\webform\WebformSubmissionViewBuilder::isElementVisible
if (!empty($options['exclude_attachments']) && $composite_plugin instanceof WebformElementAttachmentInterface) {
return '';
}
$format_function = 'format' . $type;
return $composite_plugin
->{$format_function}($composite_element, $webform_submission, $options);
}