Make BpnApiFinisher configurable via backend
This commit is contained in:
@@ -27,6 +27,7 @@ namespace EP\EpTheme\Form;
|
|||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
use EP\EpTheme\Service\BookingApiService;
|
use EP\EpTheme\Service\BookingApiService;
|
||||||
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||||
use TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher;
|
use TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher;
|
||||||
|
|
||||||
class BpnApiFinisher extends AbstractFinisher
|
class BpnApiFinisher extends AbstractFinisher
|
||||||
@@ -46,7 +47,16 @@ class BpnApiFinisher extends AbstractFinisher
|
|||||||
|
|
||||||
protected function executeInternal()
|
protected function executeInternal()
|
||||||
{
|
{
|
||||||
|
$values = [];
|
||||||
$formValues = $this->finisherContext->getFormValues();
|
$formValues = $this->finisherContext->getFormValues();
|
||||||
$this->bookingApiService->registerAddress($formValues);
|
$mappingOption = $this->parseOption('mapping');
|
||||||
|
$mappings = GeneralUtility::trimExplode(',', $mappingOption, true);
|
||||||
|
foreach ($mappings as $mapping) {
|
||||||
|
[$remote, $local] = GeneralUtility::trimExplode(':', $mapping);
|
||||||
|
$values[$remote] = $formValues[$local];
|
||||||
|
}
|
||||||
|
if (count($values) > 0) {
|
||||||
|
$this->bookingApiService->registerAddress($values);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,35 @@ TYPO3:
|
|||||||
finishersDefinition:
|
finishersDefinition:
|
||||||
BpnApiFinisher:
|
BpnApiFinisher:
|
||||||
implementationClassName: 'EP\EpTheme\Form\BpnApiFinisher'
|
implementationClassName: 'EP\EpTheme\Form\BpnApiFinisher'
|
||||||
|
formEditor:
|
||||||
|
iconIdentifier: 'form-finisher'
|
||||||
|
label: 'BusPro Finisher'
|
||||||
|
predefinedDefaults:
|
||||||
|
options:
|
||||||
|
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'
|
||||||
formElementsDefinition:
|
formElementsDefinition:
|
||||||
Form:
|
Form:
|
||||||
|
formEditor:
|
||||||
|
editors:
|
||||||
|
900:
|
||||||
|
selectOptions:
|
||||||
|
1848:
|
||||||
|
value: 'BpnApiFinisher'
|
||||||
|
label: 'BusPro Finisher'
|
||||||
|
propertyCollections:
|
||||||
|
finishers:
|
||||||
|
1848:
|
||||||
|
identifier: 'BpnApiFinisher'
|
||||||
|
editors:
|
||||||
|
100:
|
||||||
|
label: 'BusPro Finisher'
|
||||||
|
110:
|
||||||
|
identifier: 'mapping'
|
||||||
|
templateName: 'Inspector-TextEditor'
|
||||||
|
label: 'Mapping'
|
||||||
|
propertyPath: 'options.mapping'
|
||||||
|
propertyValidators:
|
||||||
|
10: 'NotEmpty'
|
||||||
renderingOptions:
|
renderingOptions:
|
||||||
templateRootPaths:
|
templateRootPaths:
|
||||||
1505042810: 'EXT:ep_theme/Resources/Private/Templates/Form/'
|
1505042810: 'EXT:ep_theme/Resources/Private/Templates/Form/'
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ prototypeName: contactform
|
|||||||
finishers:
|
finishers:
|
||||||
-
|
-
|
||||||
identifier: BpnApiFinisher
|
identifier: BpnApiFinisher
|
||||||
|
options:
|
||||||
|
mapping: 'lastName:lastName,firstName:firstName,gender:gender,email:email,street:street,zipCode:zipCode,city:city,phone:phone'
|
||||||
-
|
-
|
||||||
options:
|
options:
|
||||||
subject: 'Kontaktanfrage von {firstName} {lastName}'
|
subject: 'Kontaktanfrage von {firstName} {lastName}'
|
||||||
|
|||||||
Reference in New Issue
Block a user