Problems I Faced and My Evaluations!

I’d a requirement earlier to get tt_content data array inside FLUID template of extended fe_login. But it’s not there by default like any conventional TYPO3 content element or EXTBASE extension modules. I think about several methods to achieve this, here are the methods I tried and failed to achieve.

  • DataProcessors
  • TYPOSCRIPT Variables
  • ViewHelpers

All these methods failed and not effective. Finally, I fed up and gone through the implementation for XCLASS although it was not recommended. Finally I got a method to achieve my requirements. In TYPO3 if you’re using the fluid template extended then it throws an event from the event dispatcher through EXTBASE framework. You could get an idea what an event dispatcher looks like from the following documentation.

So it was my first time using an event dispatcher even though I used Hooks and Signal Slots before in TYPO3 several times. When I went through the LoginController of fe_login I saw the code which shows an event is thrown from the controller. I thought it was something which is exactly the same as the signal slot dispatcher works. The implementation how it should work is explained below in the Solution section.


If you read the above section it’s mentioned that our hero of attraction is event dispatcher. Here is how it works. In core the event is thrown like below.

$this->eventDispatcher->dispatch(new ModifyLoginFormViewEvent($this->view));

So we need to invoke this event in our custom extension. Let’s say it’s something like site_package our custom extension. These are the steps for invoking the event.

Step 1: Create a file called Services.yaml inside the path EXT:site_package/Configuration/Services.yaml

Step 2: You need to configure your Event Listener class in the above created yaml file.

      - name: event.listener
        identifier: 'loginObjectIdentifier'
        event: TYPO3\CMS\FrontendLogin\Event\ModifyLoginFormViewEvent
        before: 'redirects, anotherIdentifier'

Here the identifier should be unique that’s it. You can check this whether the configuration has been added to the installation through TYPO3 Backend. In configuration module backend there is an option for viewing the event listeners PSR-14.

Backend Module Configuration

Step 3: Code Properly the EventListener Class for achieving whatever you need to achieve.

namespace VendorName\SitePackage\EventListener;

use TYPO3\CMS\FrontendLogin\Event\ModifyLoginFormViewEvent;
use TYPO3\CMS\Core\Utility\GeneralUtility;

 * Class FeloginViewModifier
 * @package VendorName\SitePackage\EventListener
class FeloginViewModifier
     * @param ModifyLoginFormViewEvent $event
    public function __invoke(ModifyLoginFormViewEvent $event): void
        $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\Extbase\\Object\\ObjectManager');
        $configurationManager = $objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager');
        $data = $configurationManager->getContentObject()->data;
        if (!empty($data) && $data['CType'] == 'felogin_login') {
            $ttContentUid = $data['uid'];
            $fileRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\FileRepository::class);
            $fileObjects = $fileRepository->findByRelation('tt_content', 'assets', $ttContentUid);
            $event->getView()->assign('ttContent', $data);
            $event->getView()->assign('assetFile', $fileObjects);

Now the assigned variables is available for you in your extended template. Cheers! If this vlog helped you I will be really happy. Looking forward to more subjects.

please comment your feedback.