WebformAttachmentToken.php in Webform 6.x
File
modules/webform_attachment/src/Element/WebformAttachmentToken.php
View source
<?php
namespace Drupal\webform_attachment\Element;
use Drupal\webform\WebformSubmissionInterface;
class WebformAttachmentToken extends WebformAttachmentBase {
public function getInfo() {
return parent::getInfo() + [
'#template' => '',
];
}
public static function getFileContent(array $element, WebformSubmissionInterface $webform_submission) {
$token_manager = \Drupal::service('webform.token_manager');
$content = $token_manager
->replace($element['#template'], $webform_submission);
return !empty($element['#trim']) ? trim($content) : $content;
}
}