【问题标题】:Flux Field Inline Fal mit CropVariantsFlux Field Inline Fal mit CropVariants
【发布时间】:2021-04-20 16:11:58
【问题描述】:

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

几乎所有的 Fields 都很好,但带有 CropVariants 的 Inline Fal 元素有点棘手。我不知道如何在配置选项中正确实现这一点。

我的字段目前如下所示:

{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"/>

理论上我可以做这样的事情;这就是我在下面的 TCA 区域的方式overrideChildTca:

['columns']['crop']['config'] =>
'cropVariants' => [
  'heroimage' => [
     'title' => 'Hero Image',
     'allowedAspectRatios' => [
       '1504x846' => [
          'title' => '1504:846',
          'value' => 1504 / 846
        ],
     ],
  ],
],

我无法让它工作?有人对如何正确配置示例有任何想法吗?谢谢!

【问题讨论】:

  • 请用英文写下您的问题!
  • 您是否尝试简单地将cropVariants 添加到与appearance 处于同一级别的config 变量?
  • 未声明的参数传递给 ViewHelper FluidTYPO3\Flux\ViewHelpers\FieldViewHelper:cropVariants。有效的参数是:类型、名称、标签、排除、配置、转换、onChange、displayCond、继承、继承空、扩展名

标签: typo3 flux fluid typo3-10.x


【解决方案1】:

我找到了为这个示例添加裁剪变体的正确书写方式。如果您将此部分添加到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
                                }
                            }
                        }
                    }
                }
            }
        },

【讨论】:

    【解决方案2】:

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

    <flux:field.inline.fal name="myField"
                           showThumbs="true"
                           cropVariants="{
                               default: {
                                 title: 'Default',
                                 allowedAspectRatios: {
                                   default: {
                                     title: '1:1',
                                     value: '1'
                                   }
                                 }
                               }
                             }"/>
    

    【讨论】:

    猜你喜欢
    • 2020-01-14
    • 1970-01-01
    • 2020-08-06
    • 1970-01-01
    • 2014-08-17
    • 2017-07-30
    • 1970-01-01
    • 2015-07-11
    • 2019-04-30
    相关资源
    最近更新 更多