Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Typo3 FAL missing alternative text field in Extension

i am using FAL in my Extension and cant get the alternative field showing. Please look at these 2 images to have a better view:

Extension edit view, no alternative text field.

Same image in Page Resources view with alternative text field.

Image 1: This is the view in my extension

Image 2: This view is in Typo3 Page Ressource Tab

As you can see the image is working fine, so its not this problem: TYPO3 fal upload image with alt-text.

Here is my TCA code:

        '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']),
        ),
    ),  

Any advise will be thankful.

like image 980
nstungcom Avatar asked Oct 20 '22 05:10

nstungcom


1 Answers

Found the solution thanks to: TYPO3 FAL: enable Alt text and Link for custom domain field and https://forge.typo3.org/issues/56884

It seems that I have overread the answere.

Here is the complete 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']),
        ),
    ),  

Important is to add these line:

'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'
      ),
    )

If you also want to limit the upload files type, you could use this:

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

You will get this: FAL upoload limit file types

like image 123
nstungcom Avatar answered Dec 26 '22 10:12

nstungcom