TYPO3 FAL: enable Alt text and Link for custom domain field

北城余情 提交于 2019-12-11 00:29:41

问题


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.


回答1:


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.




回答2:


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:


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

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

Instead of

        'foreign_types' => [


来源:https://stackoverflow.com/questions/21086702/typo3-fal-enable-alt-text-and-link-for-custom-domain-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!