2 declare(strict_types = 1);
68 parent::initializeArguments();
69 $this->registerArgument(
'as',
'string',
'');
70 $this->registerArgument(
'accept',
'array',
'Values for the accept attribute',
false, []);
80 $as = $this->arguments[
'as'];
81 $accept = $this->arguments[
'accept'];
84 if (!empty($accept)) {
85 $this->tag->addAttribute(
'accept', implode(
',', $accept));
88 if ($resource !==
null) {
89 $resourcePointerIdAttribute =
'';
90 if ($this->hasArgument(
'id')) {
91 $resourcePointerIdAttribute =
' id="' . htmlspecialchars($this->arguments[
'id']) .
'-file-reference"';
93 $resourcePointerValue = $resource->getUid();
94 if ($resourcePointerValue ===
null) {
97 $resourcePointerValue =
'file:' . $resource->getOriginalResource()->getOriginalFile()->getUid();
99 $output .=
'<input type="hidden" name="' . htmlspecialchars($this->
getName()) .
'[submittedFile][resourcePointer]" value="' . htmlspecialchars($this->hashService->appendHmac((
string)$resourcePointerValue)) .
'"' . $resourcePointerIdAttribute .
' />';
101 $this->templateVariableContainer->add($as, $resource);
102 $output .= $this->renderChildren();
103 $this->templateVariableContainer->remove($as);
125 return $this->propertyMapper->convert($resource, FileReference::class);