I'm a bit new to drupal and i'm trying to create custom payment gateway module and stuck with a problem. When creating OnSitePaymentGateway, everything is ok and i can edit checkout form with PaymentMethodAddForm. But for OffsitePaymentGatewayBase, I'm unable to output additional information to checkout form. This is the code I am using.
/**
* Provides the Cresh payment gateway.
*
* @CommercePaymentGateway(
* id = "creshio",
* label = "Cresh.io",
* display_label = "Cresh.io",
* forms = {
* "offsite-payment" = "Drupal\commerce_creshio\PluginForm\CreshioForm",
* },
*
* js_library = "commerce_creshio/creshlib",
* )
*/
class Creshio extends OffsitePaymentGatewayBase { .... }
Then I created CreshioForm.php in src/PluginForm/ and added following code.
class CreshioForm extends BasePaymentOffsiteForm {
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$form['#wrapper_id'] = Html::getUniqueId('payment-add-form-wrapper');
$form['#prefix'] = '<div id="cresh-placeholder">';
$form['#suffix'] = '</div>';
return $form;
}
}
I can't see cresh-placeholder in the form.