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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user