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¶
<?php
declare(strict_types=1);
namespace MyVendor\MyExtension\Resource\EventListener;
use TYPO3\CMS\Core\Attribute\AsEventListener;
use TYPO3\CMS\Core\Resource\Event\AfterDefaultUploadFolderWasResolvedEvent;
#[AsEventListener(
identifier: 'my-extension/after-default-upload-folder-was-resolved',
)]
final readonly class MyEventListener
{
public function __invoke(AfterDefaultUploadFolderWasResolvedEvent $event): void
{
$event->setUploadFolder($event->getUploadFolder()->getStorage()->getFolder('/'));
}
}
New in version 13.0
The PHP attribute \TYPO3\
has been
introduced to tag a PHP class as an event listener. Alternatively, or if you
need to be compatible with older TYPO3 versions, you can also register an
event listener via the Configuration/
file. Switch to
an older version of this page for an example or have a look at the section
Implementing an event listener in your extension.
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
- getUploadFolder ( ) ¶
-
- Returns
-
?\
TYPO3\ CMS\ Core\ Resource\ Folder Interface
- setUploadFolder ( \TYPO3\CMS\Core\Resource\FolderInterface $uploadFolder) ¶
-
- param $uploadFolder
-
the uploadFolder
- getPid ( ) ¶
-
- Returns
-
?int
- getTable ( ) ¶
-
- Returns
-
?string
- getFieldName ( ) ¶
-
- Returns
-
?string