OptionsFormMapperInterface
OptionsFormMapperInterface.php
:
41
Provides the options form used to configure the payment method type.
The following example adds necessary fields to configure "credit_card" payment method type:
final class CreditCardOptionsFormMapper implements OptionsFormMapperInterface
{
public function createOptionsForm(string $name, FormBuilderInterface $builder, array $context = []): void
{
$builder->add($name, CreditCardOptionsType::class, [
'disabled' => $context['translation_mode'],
]);
}
}
The \Ibexa\Contracts\Payment\PaymentMethod\Type\OptionsFormMapperInterface
implementations must be registered as a service
with ibexa.payment.payment_method.options.form_mapper
tag and type
attribute.
services:
App\PaymentMethod\CreditCardOptionsFormMapper:
tags:
- name: ibexa.payment.payment_method.options.form_mapper
type: credit_card
Methods¶
createOptionsForm() ¶
OptionsFormMapperInterface.php
:
55
Attaches the options form to the payment method form.
|
|
The following context keys are available:
-
translation_mode
: Whether the form is in translation mode. -
language_code
: The language code of the form. -
type
: The payment method type.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
$name | string | - |
The name of the target form field. |
$builder | FormBuilderInterface | - |
The form builder for the payment method. |
$context | array<string, mixed> | [] |
Additional context for the form mapper. |