File
The
File type generates a field for file relations.
Settings
| Name | Type | Default | Required |
|---|---|---|---|
| boolean | true | ||
| string|array | '' | ||
| integer | 99999 | ||
| integer | |||
| string | oneToMany | ||
| array | [] | ||
| array | [] | ||
| boolean | |||
| boolean | |||
| string | |||
| string | |||
| string | |||
| boolean | true | ||
| boolean | |||
| boolean | |||
| boolean | |||
| object | |||
| object | |||
| boolean | true | ||
| boolean | |||
| boolean | |||
| boolean | false | ||
| boolean | false | ||
| boolean | true | ||
| string|array | |||
| object | |||
| object | |||
| object | |||
| boolean | false |
extendedPalette
-
- Type
- boolean
- Default
- true
If enabled, an additional image or media palette will be rendered. For image files it consists of the additional fields
crop,alternativeandlink. For audio and media files an additionalautoplayfield is added. For other file types, like plain text, this option has no effect. Disable this option, if you don't need these additional fields.
allowed
-
- Type
- string|array
- Default
- ''
Possible values:
common-,image- types common-or your custom list of file types.media- types
maxitems
-
- Type
- integer
- Default
- 99999
Maximum number of child items. Defaults to a high value. JavaScript record validation prevents the record from being saved if the limit is not satisfied.
minitems
-
- Type
- integer
Minimum number of items. Default is no minimum. JavaScript record validation prevents the record from being saved if the limit is not satisfied. The field can be set as required by setting
minitemsto at least 1.
relationship
-
- Type
- string
- Default
- oneToMany
The relationship defines the cardinality between the relations. Possible values are
one(default), orTo Many one. In case of a oneToOne relation, the processed field will be filled directly with the file reference instead of a collection of file references. In addition,To One maxitemswill be automatically set to1.
cropVariants
-
- Type
- array
- Default
- []
It is possible to define crop variants for this specific field and Content Block. This documentation only covers the most basic configuration. Refer to the TCA documentation for a complete overview of possibilities.
Example configuration below. The aspect ratios can be defined as a float value or a fraction. Only the simple division operation
a / bis allowed.cropVariants: default: title: Teaser allowedAspectRatios: portrait: title: Portrait value: 0.75 landscape: title: Landscape value: 4 / 3 coverAreas: - x: 0.25 y: 0.3 width: 0.5 height: 0.4Copied!
overrideType
-
- Type
- array
- Default
- []
Type Overrides can be used to override the File Definition in the context of as single field. Refer to the API documentation if you want to learn more.
overrideType: image: - identifier: image_overlay_palette type: Palette label: 'LLL:EXT:core/Resources/Private/Language/locallang_tca.xlf:sys_file_reference.imageoverlayPalette' fields: - identifier: alternative useExistingField: true - identifier: description useExistingField: true - type: Linebreak - identifier: link useExistingField: true - identifier: title useExistingField: true - type: Linebreak - identifier: example_custom_field type: Text label: 'My custom Field' - type: Linebreak - identifier: crop useExistingField: trueCopied!
appearance.collapseAll
-
- Type
- boolean
When true, all file records are shown collapsed. When false, all are expanded.
appearance.expandSingle
-
- Type
- boolean
When enabled, only one file record is expanded at a time.
appearance.createNewRelationLinkTitle
-
- Type
- string
Overrides the "Create new relation" button label with a localized string.
appearance.addMediaLinkTitle
-
- Type
- string
Overrides the "Add media by URL" button label with a localized string.
appearance.uploadFilesLinkTitle
-
- Type
- string
Overrides the "Select & upload files" button label with a localized string.
appearance.useSortable
-
- Type
- boolean
- Default
- true
Activates drag & drop sorting of file records.
appearance.showPossibleLocalizationRecords
-
- Type
- boolean
Show unlocalized file records that exist in the original language but have not yet been translated.
appearance.showAllLocalizationLink
-
- Type
- boolean
Show a "Localize all records" link to fetch untranslated records from the original language.
appearance.showSynchronizationLink
-
- Type
- boolean
Show a "Synchronize" link to update to a 1:1 translation with the original language.
appearance.enabledControls
-
- Type
- object
Enables or disables individual controls on file records. Available keys with their defaults:
- edit (bool, default true)
- Show or hide the edit control.
- info (bool, default true)
- Show or hide the info control.
- dragdrop (bool, default true)
- Show or hide the drag & drop handle.
- sort (bool, default false)
- Show or hide the sort arrows.
- hide (bool, default true)
- Show or hide the hide/show toggle.
- delete (bool, default true)
- Show or hide the delete control.
- localize (bool, default true)
- Show or hide the localize control.
Example:
appearance: enabledControls: sort: true delete: falseCopied!
appearance.headerThumbnail
-
- Type
- object
Defines the dimensions of the preview thumbnail shown in the inline header. Accepts
widthandheightas string or integer values.Example:
appearance: headerThumbnail: width: 64 height: 64Copied!
appearance.fileUploadAllowed
-
- Type
- boolean
- Default
- true
Show or hide the "Select & upload file" button.
appearance.fileByUrlAllowed
-
- Type
- boolean
Show or hide the "Add media by URL" button, used to embed media from services such as YouTube or Vimeo.
appearance.elementBrowserEnabled
-
- Type
- boolean
Show or hide the element browser button.
behaviour.allowLanguageSynchronization
-
- Type
- boolean
- Default
- false
Allows to select if localization uses custom or default language value.
behaviour.disableMovingChildrenWithParent
-
- Type
- boolean
- Default
- false
Disables automatic moving of file references when the parent record is moved.
behaviour.enableCascadingDelete
-
- Type
- boolean
- Default
- true
When disabled, attached file references are not deleted when the parent record is deleted.
disallowed
-
- Type
- string|array
File extensions to disallow even if they are listed in
allowed. Accepts the same values asallowed.
fieldInformation
-
- Type
- object
See TCA fieldInformation.
fieldWizard
-
- Type
- object
See TCA fieldWizard.
overrideChildTca
-
- Type
- object
Overrides TCA configuration of the
sys_records attached to this field.file_ reference
readOnly
-
- Type
- boolean
- Default
- false
Renders the field in a way that the user can see the value but cannot edit it.
Example
Minimal
All file types allowed, no restrictions.
name: example/file
fields:
- identifier: my_file_field
type: File
Advanced / use case
Allow only image types, disable extended palette (no cropping field), require at least one image and set limit to 10 images.
name: example/image
fields:
- identifier: image
type: File
extendedPalette: false
minitems: 1
maxitems: 10
allowed: common-image-types
Allow media types like audio, video and youtube (or vimeo).
name: example/media
fields:
- identifier: media
type: File
allowed: common-media-types
Set specific crop variants for an image field.
name: example/image
fields:
- identifier: image
type: File
allowed: common-image-types
cropVariants:
desktop:
title: Desktop
allowedAspectRatios:
portrait:
title: Portrait
value: 0.75
landscape:
title: Landscape
value: 4 / 3
focusArea:
x: 0.3
y: 0.3
width: 0.4
height: 0.4
coverAreas:
- x: 0.1
y: 0.8
width: 0.8
height: 0.1
tablet:
title: Tablet
allowedAspectRatios:
square:
title: Square
value: 0.75
smartphone:
title: Smartphone
allowedAspectRatios:
landscape:
title: Landscape
value: 4 / 3
Usage in Fluid
<f:for each="{data.image}" as="image">
<f:image image="{image}" width="120" maxHeight="100"/>
</f:for>