Remove obsolete plugins
This commit is contained in:
@@ -1,117 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace EP\EpTheme\Controller;
|
|
||||||
|
|
||||||
/***************************************************************
|
|
||||||
*
|
|
||||||
* Copyright notice
|
|
||||||
*
|
|
||||||
* (c) 2018 Björn Fromme <[email protected]>, 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace EP\EpTheme\Controller;
|
|
||||||
|
|
||||||
/***************************************************************
|
|
||||||
*
|
|
||||||
* Copyright notice
|
|
||||||
*
|
|
||||||
* (c) 2018 Björn Fromme <[email protected]>, 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()
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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'
|
|
||||||
);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -31,25 +31,3 @@ $metaTagManagerRegistry->registerManager(
|
|||||||
\EP\EpTheme\MetaTag\OpenGraphMetaTagManager::class
|
\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',
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user