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. Here’s code details:
/** * Provides the Cresh payment gateway. * * @CommercePaymentGateway( * id = "creshio", * label = "Cresh.io", * display_label = "Cresh.io", * forms = { * "offsite-payment" = "Drupalcommerce_creshioPluginFormCreshioForm", * }, * * js_library = "commerce_creshio/creshlib", * ) */ class Creshio extends OffsitePaymentGatewayBase { .... }
Then I created CreshioForm.php in src/PluginForm/ and added following:
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"></div>'; $form['#suffix'] = '</div>'; return $form; } }
And i can’t see cresh-placeholder in the form