AfterDefaultUploadFolderWasResolvedEvent
New in version 12.3
The event can be used as an improved alternative for the deprecated
$GLOBALS
hook, serving the same purpose.
The PSR-14 event
\TYPO3\
allows to modify the default upload folder after it has been resolved for the
current page or user.
Example
Registration of the event listener in the extension's Services.
:
services:
# Place here the default dependency injection configuration
MyVendor\MyExtension\Resource\EventListener\MyEventListener:
tags:
- name: event.listener
identifier: 'my-extension/after-default-upload-folder-was-resolved'
Read how to configure dependency injection in extensions.
The corresponding event listener class:
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\Resource\EventListener;
use TYPO3\CMS\Core\Resource\Event\AfterDefaultUploadFolderWasResolvedEvent;
final class MyEventListener
{
public function __invoke(AfterDefaultUploadFolderWasResolvedEvent $event): void
{
$event->setUploadFolder($event->getUploadFolder()->getStorage()->getFolder('/'));
}
}
API
- class AfterDefaultUploadFolderWasResolvedEvent
-
- Fully qualified name
-
\TYPO3\
CMS\ Core\ Resource\ Event\ After Default Upload Folder Was Resolved Event
Event that is fired after the default upload folder for a user was checked