Question

I have set up a small extension with the extension builder containing a few fields, one of which is the internal_type: 'file_reference'.

'dokument' => array(
    'exclude' => 0,
    'label' => 'LLL:EXT:publikationen/Resources/Private/Language/locallang_db.xlf:tx_publikationen_domain_model_publikation.dokument',
    'config' => array(
        'type' => 'group',
        'internal_type' => 'file_reference',
        //'uploadfolder' => 'uploads/tx_publikationen',
        'allowed' => '*',
        'disallowed' => 'php',
        'size' => 5,
    ),
),

The field appears in the backend, but the Element browser is unable to show any files to select:

enter image description here

If I remove the "bparams" parameter from the URL shown above, it is able to see the files that are there.

How can this be brought to work?

Was it helpful?

Solution

FAL fields require complicated configuration. To make that easier, there is a function returning the TCA config for such a field.

Its usage for a field that allows only one file looks like this:

'dokument' => array(
    'label'   => 'LLL:EXT:publikationen/Resources/Private/Language/locallang_db.xlf:tx_publikationen_domain_model_publikation.dokument',
    'exclude' => 0,
    'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig(
        'dokument',
        array(
            'maxitems' => 1,
            'minitems' => 1,
            'appearance' => array(
                'enabledControls' => array(
                    'dragdrop' => FALSE,
                    'localize' => FALSE,
                ),
            ),
        )
    ),
),

A look into the source code of that function makes me not want to do that manually.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top