You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(ui): add hideFileInputOnCreate and hideRemoveFile to collection upload config (#11217)
### What?
Two new configuration properties added for upload enabled collections.
- *hideFileInputOnCreate* - Set to `true` to prevent the admin UI from
showing file inputs during document creation, useful for programmatic
file generation.
- *hideRemoveFile* - Set to `true` to prevent the admin UI having a way
to remove an existing file while editing.
### Why?
When using file uploads that get created programmatically in
`beforeOperation` hooks or files created using `jobs`, or when
`filesRequiredOnCreate` is false, you may want to use these new flags to
prevent users from interacting with these controls.
### How?
The new properties only impact the admin UI components to dial in the UX
for various use cases.
Screenshot showing that the upload controls are not available on create:

Screenshot showing hideRemoveFile has removed the ability to remove the
existing file:

Prerequisite for #10795
|**`adminThumbnail`**| Set the way that the [Admin Panel](../admin/overview) will display thumbnails for this Collection. [More](#admin-thumbnails)|
94
-
|**`bulkUpload`**| Allow users to upload in bulk from the list view, default is true |
95
-
|**`cacheTags`**| Set to `false` to disable the cache tag set in the UI for the admin thumbnail component. Useful for when CDNs don't allow certain cache queries. |
96
-
|**`crop`**| Set to `false` to disable the cropping tool in the [Admin Panel](../admin/overview). Crop is enabled by default. [More](#crop-and-focal-point-selector)|
97
-
|**`disableLocalStorage`**| Completely disable uploading files to disk locally. [More](#disabling-local-upload-storage)|
98
-
|**`displayPreview`**| Enable displaying preview of the uploaded file in Upload fields related to this Collection. Can be locally overridden by `displayPreview` option in Upload field. [More](/docs/fields/upload#config-options). |
99
-
|**`externalFileHeaderFilter`**| Accepts existing headers and returns the headers after filtering or modifying. |
100
-
|**`filesRequiredOnCreate`**| Mandate file data on creation, default is true. |
101
-
|**`filenameCompoundIndex`**| Field slugs to use for a compound index instead of the default filename index. |
102
-
|**`focalPoint`**| Set to `false` to disable the focal point selection tool in the [Admin Panel](../admin/overview). The focal point selector is only available when `imageSizes` or `resizeOptions` are defined. [More](#crop-and-focal-point-selector)|
103
-
|**`formatOptions`**| An object with `format` and `options` that are used with the Sharp image library to format the upload file. [More](https://sharp.pixelplumbing.com/api-output#toformat)|
104
-
|**`handlers`**| Array of Request handlers to execute when fetching a file, if a handler returns a Response it will be sent to the client. Otherwise Payload will retrieve and send back the file. |
105
-
|**`imageSizes`**| If specified, image uploads will be automatically resized in accordance to these image sizes. [More](#image-sizes)|
106
-
|**`mimeTypes`**| Restrict mimeTypes in the file picker. Array of valid mimetypes or mimetype wildcards [More](#mimetypes)|
|**`adminThumbnail`**| Set the way that the [Admin Panel](../admin/overview) will display thumbnails for this Collection. [More](#admin-thumbnails)|
94
+
|**`bulkUpload`**| Allow users to upload in bulk from the list view, default is true |
95
+
|**`cacheTags`**| Set to `false` to disable the cache tag set in the UI for the admin thumbnail component. Useful for when CDNs don't allow certain cache queries. |
96
+
|**`crop`**| Set to `false` to disable the cropping tool in the [Admin Panel](../admin/overview). Crop is enabled by default. [More](#crop-and-focal-point-selector)|
97
+
|**`disableLocalStorage`**| Completely disable uploading files to disk locally. [More](#disabling-local-upload-storage)|
98
+
|**`displayPreview`**| Enable displaying preview of the uploaded file in Upload fields related to this Collection. Can be locally overridden by `displayPreview` option in Upload field. [More](/docs/fields/upload#config-options). |
99
+
|**`externalFileHeaderFilter`**| Accepts existing headers and returns the headers after filtering or modifying. |
100
+
|**`filesRequiredOnCreate`**| Mandate file data on creation, default is true. |
101
+
|**`filenameCompoundIndex`**| Field slugs to use for a compound index instead of the default filename index. |
102
+
|**`focalPoint`**| Set to `false` to disable the focal point selection tool in the [Admin Panel](../admin/overview). The focal point selector is only available when `imageSizes` or `resizeOptions` are defined. [More](#crop-and-focal-point-selector)|
103
+
|**`formatOptions`**| An object with `format` and `options` that are used with the Sharp image library to format the upload file. [More](https://sharp.pixelplumbing.com/api-output#toformat)|
104
+
|**`handlers`**| Array of Request handlers to execute when fetching a file, if a handler returns a Response it will be sent to the client. Otherwise Payload will retrieve and send back the file. |
105
+
|**`imageSizes`**| If specified, image uploads will be automatically resized in accordance to these image sizes. [More](#image-sizes)|
106
+
|**`mimeTypes`**| Restrict mimeTypes in the file picker. Array of valid mimetypes or mimetype wildcards [More](#mimetypes)|
107
107
|**`pasteURL`**| Controls whether files can be uploaded from remote URLs by pasting them into the Upload field. **Enabled by default.** Accepts `false` to disable or an object with an `allowList` of valid remote URLs. [More](#uploading-files-from-remote-urls)|
108
-
|**`resizeOptions`**| An object passed to the the Sharp image library to resize the uploaded file. [More](https://sharp.pixelplumbing.com/api-resize)|
109
-
|**`staticDir`**| The folder directory to use to store media in. Can be either an absolute path or relative to the directory that contains your config. Defaults to your collection slug |
110
-
|**`trimOptions`**| An object passed to the the Sharp image library to trim the uploaded file. [More](https://sharp.pixelplumbing.com/api-resize#trim)|
111
-
|**`withMetadata`**| If specified, appends metadata to the output image file. Accepts a boolean or a function that receives `metadata` and `req`, returning a boolean. |
108
+
|**`resizeOptions`**| An object passed to the the Sharp image library to resize the uploaded file. [More](https://sharp.pixelplumbing.com/api-resize)|
109
+
|**`staticDir`**| The folder directory to use to store media in. Can be either an absolute path or relative to the directory that contains your config. Defaults to your collection slug |
110
+
|**`trimOptions`**| An object passed to the the Sharp image library to trim the uploaded file. [More](https://sharp.pixelplumbing.com/api-resize#trim)|
111
+
|**`withMetadata`**| If specified, appends metadata to the output image file. Accepts a boolean or a function that receives `metadata` and `req`, returning a boolean. |
112
+
|**`hideFileInputOnCreate`**| Set to `true` to prevent the admin UI from showing file inputs during document creation, useful for programmatic file generation. |
113
+
|**`hideRemoveFile`**| Set to `true` to prevent the admin UI having a way to remove an existing file while editing. |
0 commit comments