In the LayoutProccesor.php I need to add two lines to the processPaymentConfiguration function. Now since this is a private function I can't write a plugin for it.
private function processPaymentConfiguration(array &$configuration, array $elements)
{
$output = [];
foreach ($configuration as $paymentGroup => $groupConfig) {
foreach ($groupConfig['methods'] as $paymentCode => $paymentComponent) {
if (empty($paymentComponent['isBillingAddressRequired'])) {
continue;
}
$output[$paymentCode . '-form'] = $this->getBillingAddressComponent($paymentCode, $elements);
// CUSTOMCODE
unset($output[$paymentCode . '-form']['children']['form-fields']['children']['street']['label']);
$output[$paymentCode . '-form']['children']['form-fields']['children']['street']['children']['0']['label'] = __('Address');
// END OF CUSTOM CODE
}
unset($configuration[$paymentGroup]['methods']);
}
return $output;
}
I rather not overwrite the LayoutProcessor all together since that might bring problems with other extensions?
I tried adding the two lines to an aroundProcess plugin since that is the only public function in the LayoutProcessor. But that didn't work. It is as if the private function is run after that around plugin? I also tried an after plugin without succes.
Any idea?
I'm trying to add the Address label to the street 0 while being in the checkout with a Downloadable product (so the checkout is a bit different).
I need to do this:
$jsLayoutResult['components']['checkout']['children']['steps']['children']['billing-step']['children']['payment']['children']['renders']['children']['checkmo-form']['children']['form-fields']['children']['street']['children']['0']['label'] = __('Address');
I tried:
- Adding it to an around plugin on process
- Adding it to an after plugin on process
If i add it directly in the LayoutProcessor.php then the code works so the lines of code are definitely correct. But since that is back practice it isn't an option.
Overwriting the whole LayoutProcessor is bad practice too since I'm creating a checkout and other extensions still need to work.
Any idea?