public static function WebformAttachmentTwig::getFileContent in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_attachment/src/Element/WebformAttachmentTwig.php \Drupal\webform_attachment\Element\WebformAttachmentTwig::getFileContent()
Get a webform attachment's file content.
Parameters
array $element: The webform attachment element.
\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.
Return value
mixed|string The attachment's file content.
Overrides WebformAttachmentInterface::getFileContent
File
- modules/
webform_attachment/ src/ Element/ WebformAttachmentTwig.php, line 27
Class
- WebformAttachmentTwig
- Provides a 'webform_attachment_twig' element.
Namespace
Drupal\webform_attachment\ElementCode
public static function getFileContent(array $element, WebformSubmissionInterface $webform_submission) {
$options = [];
$template = $element['#template'];
$content = WebformTwigExtension::renderTwigTemplate($webform_submission, $template, $options);
return !empty($element['#trim']) ? trim($content) : $content;
}