Merge branch 'develop'
This commit is contained in:
@@ -67,7 +67,9 @@ class ConceptController extends ActionController
|
||||
$concept = $this->conceptRepository->findByIdentifier($conceptUid);
|
||||
}
|
||||
$teaserConceptUids = GeneralUtility::trimExplode(',', $this->settings['additionalConceptUids']);
|
||||
array_unshift($teaserConceptUids, $concept->getUid());
|
||||
if (null !== $concept) {
|
||||
array_unshift($teaserConceptUids, $concept->getUid());
|
||||
}
|
||||
$filterSettings = new FilterSettings();
|
||||
$filterSettings->setConceptUids($teaserConceptUids);
|
||||
$excludedConceptUids = GeneralUtility::trimExplode(',', $this->settings['excludedConceptUids'], true);
|
||||
|
||||
@@ -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'
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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',
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user