public static function WebformAttachmentToken::getFileContent in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_attachment/src/Element/WebformAttachmentToken.php \Drupal\webform_attachment\Element\WebformAttachmentToken::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/ WebformAttachmentToken.php, line 26
Class
- WebformAttachmentToken
- Provides a 'webform_attachment_token' element.
Namespace
Drupal\webform_attachment\ElementCode
public static function getFileContent(array $element, WebformSubmissionInterface $webform_submission) {
/** @var \Drupal\webform\WebformTokenManagerInterface $token_manager */
$token_manager = \Drupal::service('webform.token_manager');
$content = $token_manager
->replace($element['#template'], $webform_submission);
return !empty($element['#trim']) ? trim($content) : $content;
}