Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove XCLASS FormController #29

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions Classes/Controller/FormController.php

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

declare(strict_types=1);
namespace TRAW\Powermailcaptcha\EventListener;

use In2code\Powermail\Events\FormControllerFormActionEvent;
use TYPO3\CMS\Core\SingletonInterface;

/**
* >= v12 only
*
* Listens to event FormControllerFormActionEvent
* @see \In2code\Powermail\Events\FormControllerFormActionEvent
*
* Documentation: How to listen to events
* @see https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Events/EventDispatcher/Index.html
*/
final class PowermailFormControllerFormActionEventListener implements SingletonInterface
{
public function handleEvent(FormControllerFormActionEvent $event): void
{
$form = $event->getForm();
if ($form === null) {
return;
}
$formController = $event->getFormController();
$settings = $formController->getSettings();

if ($settings['powermailcaptcha']['useSiteLanguage'] ?? 0) {
/** !!!! this method does not exist yet
* see https://github.com/in2code-de/powermail/pull/1199
*/
if (method_exists($event, 'addViewVariables')) {
$event->addViewVariables([
'languageIso' => $GLOBALS['TYPO3_REQUEST']->getAttribute('language')->getLocale()->getLanguageCode()
]
);
}
}
}
}
14 changes: 14 additions & 0 deletions Configuration/Services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false

TRAW\Powermailcaptcha\:
resource: '../Classes/*'

TRAW\Powermailcaptcha\EventListener\PowermailFormControllerFormActionEventListener:
tags:
- name: event.listener
method: handleEvent
identifier: 'powermailcaptchaFormControllerFormActionEventListener'
7 changes: 0 additions & 7 deletions ext_localconf.php

This file was deleted.