Typo3 FAL 在扩展中缺少替代文本字段

Typo3 FAL missing alternative text field in Extension

我在我的扩展中使用 FAL,但无法显示 alternative 字段。 请查看这两张图片以获得更好的视图:

图 1:这是我的扩展中的视图

图片 2:此视图位于 Typo3 页面资源选项卡中

如您所见,图像工作正常,所以不是这个问题:TYPO3 fal upload image with alt-text

这是我的 TCA 代码:

        'images' => array(
        'exclude' => 1,
        'label' => 'LLL:EXT:fy_reference/Resources/Private/Language/locallang_db.xlf:tx_fyreference_domain_model_reference.images',
        'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('image', array(
          'appearance' => array(
            'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
          ),
          'minitems' => 0,
          'maxitems' => 9999,
        ), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']),
        'files' => array(
          'exclude' => 1,
          'label' => 'Files',
          'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('files', array(
      'appearance' => array(
        'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
      ),
          ), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']),
        ),
    ),  

如有指教,将不胜感激。

找到解决方案感谢:TYPO3 FAL: enable Alt text and Link for custom domain field and https://forge.typo3.org/issues/56884

看来我看多了答案。

这是完整的 TCA:

'images' => array(
        'exclude' => 1,
        'label' => 'LLL:EXT:fy_reference/Resources/Private/Language/locallang_db.xlf:tx_fyreference_domain_model_reference.images',
        'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('image', array(
            'foreign_selector_fieldTcaOverride' => array(
              'config' => array(
                'appearance' => array(
                  'elementBrowserType' => 'file',
                  'elementBrowserAllowed' => 'gif,jpg,jpeg,tif,tiff,bmp,png'
                )
              )
            ),                              
          'appearance' => array(
            'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference',
          ),
          'minitems' => 0,
          'maxitems' => 9999,
          'foreign_types' => array(
      '0' => array(
        'showitem' => '
            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
            --palette--;;filePalette'
      ),
      \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
        'showitem' => '
          --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
          --palette--;;filePalette'
      ),
    )
        ), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']),
        'files' => array(
          'exclude' => 1,
          'label' => 'Files',
          'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('files', array(
      'appearance' => array(
        'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference'
      ),
          ), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']),
        ),
    ),  

重要的是添加这些行:

'foreign_types' => array(
      '0' => array(
        'showitem' => '
            --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
            --palette--;;filePalette'
      ),
      \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => array(
        'showitem' => '
          --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,
          --palette--;;filePalette'
      ),
    )

如果你也想限制上传文件的类型,你可以使用这个:

'foreign_selector_fieldTcaOverride' => array(
    'config' => array(
        'appearance' => array(
            'elementBrowserType' => 'file',
            'elementBrowserAllowed' => 'gif,jpg,jpeg,tif,tiff,bmp,png'
        )
    )
),

你会得到这个: