目前,我正在用Flux更新一个TYPO3项目到TYPO3 10,现在我想将所有字段迁移到FieldViewhelper
。
大多数情况下,所有的领域都打得很好,但是使用CropVariants的内联Fal元素有点棘手。我不知道如何在config选项中正确地实现这一点。
我的字段目前如下所示:
{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, --palette--;;filePalette'
},
2: {
showitem: '--palette--;;imageoverlayPalette, --palette--;;filePalette'
},
3: {
showitem: '--palette--;;audioOverlayPalette, --palette--;;filePalette'
},
4: {
showitem: '--palette--;;videoOverlayPalette, --palette--;;filePalette'
},
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
下面的TCA区域所做的事情。
['columns']['crop']['config'] =>
'cropVariants' => [
'heroimage' => [
'title' => 'Hero Image',
'allowedAspectRatios' => [
'1504x846' => [
'title' => '1504:846',
'value' => 1504 / 846
],
],
],
],
我不能让它开始工作?有没有人想过如何正确地配置这一点?谢谢!
发布于 2021-01-20 10:31:01
我找到了为本例添加作物变体的正确书写方式。如果将此部分添加到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
}
}
}
}
}
}
},
发布于 2021-01-19 14:02:02
至少对于<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'
}
}
}
}"/>
https://stackoverflow.com/questions/65739355
复制相似问题