首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >通量场内插Fal mit CropVariants

通量场内插Fal mit CropVariants
EN

Stack Overflow用户
提问于 2021-01-15 15:59:31
回答 2查看 436关注 0票数 0

目前,我正在用Flux更新一个TYPO3项目到TYPO3 10,现在我想将所有字段迁移到FieldViewhelper

大多数情况下,所有的领域都打得很好,但是使用CropVariants的内联Fal元素有点棘手。我不知道如何在config选项中正确地实现这一点。

我的字段目前如下所示:

代码语言:javascript
运行
复制
{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区域所做的事情。

代码语言:javascript
运行
复制
['columns']['crop']['config'] =>
'cropVariants' => [
  'heroimage' => [
     'title' => 'Hero Image',
     'allowedAspectRatios' => [
       '1504x846' => [
          'title' => '1504:846',
          'value' => 1504 / 846
        ],
     ],
  ],
],

我不能让它开始工作?有没有人想过如何正确地配置这一点?谢谢!

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-01-20 10:31:01

我找到了为本例添加作物变体的正确书写方式。如果将此部分添加到overrideChildTca -> columns -> crop -> config中,则应该可以:)

代码语言:javascript
运行
复制
    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
                                }
                            }
                        }
                    }
                }
            }
        },
票数 1
EN

Stack Overflow用户

发布于 2021-01-19 14:02:02

至少对于<flux.field.inline.fal>和TYPO3 9.5,您可以通过XML属性简单地设置cropVariants

代码语言:javascript
运行
复制
<flux:field.inline.fal name="myField"
                       showThumbs="true"
                       cropVariants="{
                           default: {
                             title: 'Default',
                             allowedAspectRatios: {
                               default: {
                                 title: '1:1',
                                 value: '1'
                               }
                             }
                           }
                         }"/>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65739355

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档