TYPO3 FAL: enable Alt text and Link for custom dom

2019-07-14 17:31发布

I have a "Products" extension with a db table "tx_xxxproducts_domain_model_product" having a field "accessories":

'accessories' => array(
    'exclude' => 0,
    'label' => 'LLL:EXT:xxx_products/Resources/Private/Language/locallang_db.xlf:tx_xxxproducts_domain_model_product.accessories',
    'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('accessories', array( 
        'appearance' => array( 
            'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference', 
            'collapseAll' => TRUE, 
        ), 
    ), $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']) 
),

This field should have references to images. It works, but the file references only have the fields Title and Description. How can I add Link and Alternative Text, as the default Images CType has?

Thank you.

3条回答
Lonely孤独者°
2楼-- · 2019-07-14 17:55

add this in your array element 'config', after 'appearance' for example:

'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_TEXT => 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'
                ),
                \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => array(
                    'showitem' => '--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette'
                ),
                \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => array(
                    'showitem' => '--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette'
                ),
                \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => array(
                    'showitem' => '--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette'
                ),
            ),
查看更多
该账号已被封号
3楼-- · 2019-07-14 17:56

TYPO3 v8 Change => https://docs.typo3.org/typo3cms/TCAReference/ColumnsConfig/Type/Inline.html#file-abstraction-layer

        'overrideChildTca' => [
            'types' => [

Instead of

        'foreign_types' => [
查看更多
叼着烟拽天下
4楼-- · 2019-07-14 18:02

I found the answer in tt_content's TCA:

'accessories' => array(
    'exclude' => 0,
    'label' => 'LLL:EXT:xxx_products/Resources/Private/Language/locallang_db.xlf:tx_xxxproducts_domain_model_product.accessories',
    'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('accessories', array( 
        'appearance' => array( 
            'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference', 
            'collapseAll' => TRUE, 
        ), 
        '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']) 
),

Check the 'foreign_types' key.

查看更多
登录 后发表回答