Make BpnApiFinisher configurable via backend
This commit is contained in:
@@ -27,6 +27,7 @@ namespace EP\EpTheme\Form;
|
||||
***************************************************************/
|
||||
|
||||
use EP\EpTheme\Service\BookingApiService;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Form\Domain\Finishers\AbstractFinisher;
|
||||
|
||||
class BpnApiFinisher extends AbstractFinisher
|
||||
@@ -46,7 +47,16 @@ class BpnApiFinisher extends AbstractFinisher
|
||||
|
||||
protected function executeInternal()
|
||||
{
|
||||
$values = [];
|
||||
$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:
|
||||
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:
|
||||
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:
|
||||
templateRootPaths:
|
||||
1505042810: 'EXT:ep_theme/Resources/Private/Templates/Form/'
|
||||
|
||||
@@ -8,6 +8,8 @@ prototypeName: contactform
|
||||
finishers:
|
||||
-
|
||||
identifier: BpnApiFinisher
|
||||
options:
|
||||
mapping: 'lastName:lastName,firstName:firstName,gender:gender,email:email,street:street,zipCode:zipCode,city:city,phone:phone'
|
||||
-
|
||||
options:
|
||||
subject: 'Kontaktanfrage von {firstName} {lastName}'
|
||||
|
||||
Reference in New Issue
Block a user