WebformAttachmentTwig.php in Webform 6.x
File
modules/webform_attachment/src/Element/WebformAttachmentTwig.php
View source
<?php
namespace Drupal\webform_attachment\Element;
use Drupal\webform\Twig\WebformTwigExtension;
use Drupal\webform\WebformSubmissionInterface;
class WebformAttachmentTwig extends WebformAttachmentBase {
public function getInfo() {
return parent::getInfo() + [
'#template' => '',
];
}
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;
}
}