ModifyEditFileFormDataEvent

New in version 12.1

The PSR-14 event \TYPO3\CMS\Filelist\Event\ModifyEditFileFormDataEvent allows to modify the form data, used to render the file edit form in the File > Filelist module using FormEngine data compiling.

Example

EXT:my_extension/Classes/FileList/EventListener/MyEventListener.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\FileList\EventListener;

use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Filelist\Event\ModifyEditFileFormDataEvent;

#[AsEventListener(
    identifier: 'my-extension/modify-edit-file-form-data',
)]
final readonly class MyEventListener
{
    public function __invoke(ModifyEditFileFormDataEvent $event): void
    {
        // Get current form data
        $formData = $event->getFormData();

        // Change TCA "renderType" based on the file extension
        $fileExtension = $event->getFile()->getExtension();
        if ($fileExtension === 'ts') {
            $formData['processedTca']['columns']['data']['config']['renderType'] = 'tsRenderer';
        }

        // Set updated form data
        $event->setFormData($formData);
    }
}
Copied!

New in version 13.0

API

class ModifyEditFileFormDataEvent
Fully qualified name
\TYPO3\CMS\Filelist\Event\ModifyEditFileFormDataEvent

Listeners to this event are be able to modify the form data, used to render the edit file form in the filelist module.

getFormData ( )
Returns
array
setFormData ( array $formData)
param $formData

the formData

getFile ( )
Returns
\TYPO3\CMS\Core\Resource\FileInterface
getRequest ( )
Returns
\Psr\Http\Message\ServerRequestInterface