问题描述
我目前正在将带有 Flux 的 TYPO3 项目更新到 TYPO3 10,现在我想将所有字段迁移到 **NumberSquarer()
。
几乎所有的 Fields 都打得很好,但是带有 CropVariants 的 Inline Fal 元素有点棘手。我不知道如何在配置选项中正确实现这一点。
我的字段目前看起来像这样:
FieldViewhelper
理论上我可以做这样的事情;这就是我在下面的 TCA 区域中的做法{f:variable(name: '_allowedFileExtensions',value: '{allowedFileExtensions}')}
{f:variable(name: '_disallowedFileExtensions',value: '{disallowedFileExtensions}')}
<f:variable name="config" value="{
type: 'inline',foreign_table: 'sys_file_reference',foreign_field: 'uid_foreign',foreign_sortby: 'sorting_foreign',foreign_table_field: 'tablenames',foreign_match_fields: {
fieldname: name
},foreign_label: 'uid_local',foreign_selector: 'uid_local',maxitems: maxitems,minitems: minitems,multiple: multiple,overrideChildTca: {
columns: {
uid_local: {
config: {
appearance: {
elementbrowserType: 'file',elementbrowserAllowed: _allowedFileExtensions
}
}
}
},types: {
0: {
showitem: '--palette--;;imageoverlayPalette,--palette--;;filePalette'
},1: {
showitem: '--palette--;;imageoverlayPalette,2: {
showitem: '--palette--;;imageoverlayPalette,3: {
showitem: '--palette--;;audioOverlayPalette,4: {
showitem: '--palette--;;videoOverlayPalette,5: {
showitem: '--palette--;;imageoverlayPalette,--palette--;;filePalette'
}
}
},filter: {
0: {
userFunc: 'TYPO3\\CMS\\Core\\Resource\\Filter\\FileExtensionFilter->filterInlineChildren',parameters: {
allowedFileExtensions: _allowedFileExtensions,disallowedFileExtensions: _disallowedFileExtensions
}
}
},appearance: {
useSortable: 1,headerThumbnail: {
field: 'uid_local',width: '45',height: '45c'
},showPossibleLocalizationRecords: 0,showRemovedLocalizationRecords: 0,showSynchronizationLink: 0,showAllLocalizationLink: 0,enabledControls: {
info: 1,new: 0,dragdrop: 1,sort: 0,hide: 1,delete: 1,localize: 1
}
}
}" />
<flux:field type="inline" name="{name}" label="{label}" config="{config}" exclude="0"/>
:
overrideChildTca
我无法让它工作?有人对如何正确配置这个例子有任何想法吗?谢谢!
解决方法
我找到了为此示例添加作物变体的正确书写方式。如果您将此部分添加到 overrideChildTca
-> columns
-> crop
-> config
中,那么它应该可以工作:)
overrideChildTca: {
columns: {
crop: {
config: {
type: 'imageManipulation',cropVariants: {
tablet: {
title: 'Tablet',allowedAspectRatios: {
NaN: {
title: 'Free',value: 0.0
},'21-9': {
title: '21:9',value: 2.3333333
}
}
}
}
}
}
},
,
至少对于 <flux.field.inline.fal>
和 TYPO3 9.5,您可以通过 XML 属性简单地设置 cropVariants
:
<flux:field.inline.fal name="myField"
showThumbs="true"
cropVariants="{
default: {
title: 'Default',allowedAspectRatios: {
default: {
title: '1:1',value: '1'
}
}
}
}"/>