From 79a3accb1dfed8d6da5b4e8e4d5191bc0b0daecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Tue, 14 Sep 2021 18:32:58 +0200 Subject: [PATCH 1/2] Remove obsolete plugins --- .../Classes/Controller/AjaxFormController.php | 117 ------------------ .../Classes/Controller/FormController.php | 64 ---------- .../TCA/Overrides/tt_content.php | 13 -- .../typo3conf/ext/ep_theme/ext_localconf.php | 22 ---- 4 files changed, 216 deletions(-) delete mode 100644 public/typo3conf/ext/ep_theme/Classes/Controller/AjaxFormController.php delete mode 100644 public/typo3conf/ext/ep_theme/Classes/Controller/FormController.php diff --git a/public/typo3conf/ext/ep_theme/Classes/Controller/AjaxFormController.php b/public/typo3conf/ext/ep_theme/Classes/Controller/AjaxFormController.php deleted file mode 100644 index 39202814..00000000 --- a/public/typo3conf/ext/ep_theme/Classes/Controller/AjaxFormController.php +++ /dev/null @@ -1,117 +0,0 @@ -, dreipunktnull - * - * All rights reserved - * - * This script is part of the TYPO3 project. The TYPO3 project is - * free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * The GNU General Public License can be found at - * http://www.gnu.org/copyleft/gpl.html. - * - * This script is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * This copyright notice MUST APPEAR in all copies of the script! - ***************************************************************/ - -use EP\EpTheme\Service\BookingApiService; -use EP\EpTheme\Service\EmailService; -use EP\EpTheme\Domain\Model\Dto\ContactForm; -use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; -use TYPO3\CMS\Extbase\Utility\LocalizationUtility; - -class AjaxFormController extends ActionController -{ - - /** - * @var EmailService - */ - protected $emailService; - - /** - * @var BookingApiService - */ - protected $bookingApiService; - - /** - * @param EmailService $emailService - * @param BookingApiService $bookingApiService - */ - public function __construct(EmailService $emailService, BookingApiService $bookingApiService) - { - $this->emailService = $emailService; - $this->bookingApiService = $bookingApiService; - } - - /** - * @param ContactForm $contactForm - * @return string - */ - public function processFormAction(ContactForm $contactForm) - { - $response['status'] = 'ok'; - - // Don't take further actions in case honeypot field is filled in - // as a spam countermeasure - if ($contactForm->getSubject()) { - return json_encode($response); - } - - $this->emailService->send( - $this->settings['contactFormToEmail'], - $this->settings['contactFormToName'], - 'Kontaktformular E&P Reisen', - 'ContactForm', - [ 'contactForm' => $contactForm ] - ); - - $addressData = [ - 'lastName' => $contactForm->getName(), - 'firstName' => $contactForm->getFirstName(), - 'email' => $contactForm->getEmail(), - 'gender' => $contactForm->getGender(), - ]; - - $this->bookingApiService->registerAddress($addressData); - - return json_encode($response); - } - - /** - * @return string - */ - protected function errorAction() { - $formErrors = []; - if ($this->arguments->validate()->hasErrors()) { - foreach ($this->arguments->validate()->getFlattenedErrors() as $key => $errors) - { - [ $formName, $fieldName ] = explode('.', $key); - $errorsRaw = []; - foreach ($errors as $error) - { - $translationKey = sprintf('tx_eptheme.message.%s.%s', $key, $error->getCode()); - $errorsRaw[] = LocalizationUtility::translate($translationKey, 'ep_theme'); - } - $formErrors[$fieldName] = implode(', ', $errorsRaw); - } - } - - $response['status'] = 'validation'; - $response['errors'] = $formErrors; - - return json_encode($response); - } - -} diff --git a/public/typo3conf/ext/ep_theme/Classes/Controller/FormController.php b/public/typo3conf/ext/ep_theme/Classes/Controller/FormController.php deleted file mode 100644 index 1a6d44ba..00000000 --- a/public/typo3conf/ext/ep_theme/Classes/Controller/FormController.php +++ /dev/null @@ -1,64 +0,0 @@ -, dreipunktnull - * - * All rights reserved - * - * This script is part of the TYPO3 project. The TYPO3 project is - * free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * The GNU General Public License can be found at - * http://www.gnu.org/copyleft/gpl.html. - * - * This script is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * This copyright notice MUST APPEAR in all copies of the script! - ***************************************************************/ - -use EP\EpTheme\Domain\Model\Dto\ContactForm; -use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; - -class FormController extends ActionController -{ - /** - * @param ContactForm $contactForm - */ - public function simpleFormAction(ContactForm $contactForm = null) - { - if ($contactForm === null) { - $pageUrl = $this->getCurrentPageUrl(); - $contactForm = new ContactForm($pageUrl, ContactForm::FORM_TYPE_SIMPLE); - } - $this->view->assign('contactForm', $contactForm); - } - - /** - * @return string - */ - private function getCurrentPageUrl() - { - if (GeneralUtility::_GET('ref')) { - $pageUid = GeneralUtility::_GET('ref'); - } else { - $pageUid = $GLOBALS['TSFE']->id; - } - return $this->uriBuilder - ->reset() - ->setCreateAbsoluteUri(true) - ->setTargetPageUid((int)$pageUid) - ->build() - ; - } -} diff --git a/public/typo3conf/ext/ep_theme/Configuration/TCA/Overrides/tt_content.php b/public/typo3conf/ext/ep_theme/Configuration/TCA/Overrides/tt_content.php index 42431cb5..cdb4f774 100644 --- a/public/typo3conf/ext/ep_theme/Configuration/TCA/Overrides/tt_content.php +++ b/public/typo3conf/ext/ep_theme/Configuration/TCA/Overrides/tt_content.php @@ -201,17 +201,4 @@ call_user_func(function () { ], ], ]; - - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( - 'EP.EpTheme', - 'SimpleForm', - 'Kurzformular' - ); - - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( - 'EP.EpTheme', - 'FullForm', - 'Anfrageformular Gruppen' - ); - }); diff --git a/public/typo3conf/ext/ep_theme/ext_localconf.php b/public/typo3conf/ext/ep_theme/ext_localconf.php index 54a9277d..5ca11649 100644 --- a/public/typo3conf/ext/ep_theme/ext_localconf.php +++ b/public/typo3conf/ext/ep_theme/ext_localconf.php @@ -31,25 +31,3 @@ $metaTagManagerRegistry->registerManager( \EP\EpTheme\MetaTag\OpenGraphMetaTagManager::class ); -\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'EP.ep_theme', - 'SimpleForm', - [ - 'Form' => 'simpleForm', - ], - [ - 'Form' => 'simpleForm', - ] -); - -\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'EP.ep_theme', - 'Ajax', - [ - 'AjaxForm' => 'processForm', - ], - [ - 'AjaxForm' => 'processForm', - ] -); - From e08b0ea803618934fdadfe70a6d23d05155ed178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Tue, 14 Sep 2021 18:33:31 +0200 Subject: [PATCH 2/2] Adjust default finisher configuration to match previous plugin --- .../ext/ep_theme/Configuration/Yaml/FormFinishersFrontend.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/typo3conf/ext/ep_theme/Configuration/Yaml/FormFinishersFrontend.yaml b/public/typo3conf/ext/ep_theme/Configuration/Yaml/FormFinishersFrontend.yaml index b9e8cb73..6de1872a 100644 --- a/public/typo3conf/ext/ep_theme/Configuration/Yaml/FormFinishersFrontend.yaml +++ b/public/typo3conf/ext/ep_theme/Configuration/Yaml/FormFinishersFrontend.yaml @@ -10,7 +10,7 @@ TYPO3: label: 'BusPro Finisher' options: identifier: 'BpnApiFinisher' - mapping: 'lastName:text-1,firstName:text-2,gender:singleselect-1,email:email-1,street:text-3,zipCode:text-4,city:text-5,phone:telephone-1' + mapping: 'lastName:text-1,firstName:text-2,gender:singleselect-1,email:email-1' AddReferrerFinisher: implementationClassName: 'EP\EpTheme\Form\AddReferrerFinisher' formEditor: