Skip to content

Commit

Permalink
Merge pull request #90 from mficzel/feature/addCollectionNameToUploads
Browse files Browse the repository at this point in the history
FEATURE: Add `collectionName` option to `Neos.Fusion.Form:Upload`
  • Loading branch information
mficzel committed Feb 16, 2024
2 parents 1147045 + a46aec8 commit 90c960f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Documentation/FusionReference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ Neos.Fusion.Form:Upload

Extends `Neos.Fusion.Form:Input`_ and uses the default type `file`.

:collectionName: (string, default = null) name of the resource collection this file should be uploaded to.

.. note:
By default the "persistent" collection defined by flow will be used for all uploads unless a `collectionName` is set.
It is strongly recommended to changes that to a different collection that is not publicly available!
Neos.Fusion.Form:Password
-------------------------

Expand Down
7 changes: 7 additions & 0 deletions Resources/Private/Fusion/Prototypes/Upload.fusion
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@ prototype(Neos.Fusion.Form:Upload) < prototype(Neos.Fusion.Form:Component.Field

attributes.type = "file"

collectionName = null

renderer = afx`
<input
@if.has={Type.instance(field.getCurrentValue(), 'Neos\Flow\ResourceManagement\PersistentResource')}
type="hidden" name={field.getName() + '[originallySubmittedResource][__identity]'}
value={field.getCurrentValueStringified()}
/>
<input
@if.has={props.collectionName}
type="hidden" name={field.getName() + '[__collectionName]'}
value={props.collectionName}
/>
<input
name={field.getName()}
{...props.attributes}
Expand Down

0 comments on commit 90c960f

Please sign in to comment.