Drupal自定义付款模块表格问题
我对Drupal有点陌生,我正在尝试创建自定义付款网关模块,并遇到问题。 在创建OnSitePaymentGateway时,一切都还好,我可以使用Paymethodaddform编辑结帐表格。但是对于OffSitePaymentGateWayBase,我无法输出其他信息以结帐表格。 此处的代码详细信息:
/**
* 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 { .... }
然后,我在src/ pluginform/中创建了creshioform.php,并添加了以下内容:
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;
}
}
我看不到cresh-placeholder的形式
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" = "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:
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;
}
}
And i can't see cresh-placeholder in the form
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论