为了账号安全,请及时绑定邮箱和手机立即绑定

为什么我的自定义代码在日志中显示警告?

为什么我的自定义代码在日志中显示警告?

PHP
慕盖茨4494581 2021-05-07 10:12:17
我在Drupal 8.6和Bootstrap 3.3.7上有一个网站我创建了一个自定义模块,供客户在下订单时接受商店的条款和条件。这将显示指向付款前复选框的链接,以在模式窗口中显示条款和条件。当我在这里下订单时,日志中会显示警告(很抱歉,我的代码太长了,无法在此处发布):https://pastebin.com/1p5m1Vedhttps://pastebin.com/XYbqDJjehttps://pastebin.com/P93bStKh这是造成问题的文件:<?phpnamespace Drupal\commerce_marketplace_terms_and_conditions\Plugin\Commerce\CheckoutPane;use Drupal\Component\Serialization\Json;use Drupal\Core\Form\FormStateInterface;use Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneBase;use Drupal\commerce_checkout\Plugin\Commerce\CheckoutPane\CheckoutPaneInterface;use Drupal\Core\Link;use Drupal\Core\Url;/** * Provides the completion message pane. * * @CommerceCheckoutPane( *   id = "marketplace_terms_and_conditions", *   label = @Translation("Marketplace Terms and Conditions"), *   default_step = "review", * ) */class MarketplaceTermsAndConditions extends CheckoutPaneBase implements CheckoutPaneInterface {  /**   * {@inheritdoc}   */  public function buildPaneForm(array $pane_form, FormStateInterface $form_state, array &$complete_form) {    $store_name = $this->order->getStore()->getName();    $store_id = $this->order->getStoreId();    $pane_form['#attached']['library'][] = 'core/drupal.dialog.ajax';    $attributes = [      'attributes' => [        'class' => 'use-ajax',        'data-dialog-type' => 'modal',        'data-dialog-options' => Json::encode([          'width' => auto        ]),      ],    ];    $link = Link::fromTextAndUrl(      $this->t('terms and conditions of the store "@store_name"', ['@store_name' => $store_name]),      Url::fromUri("internal:/store/$store_id/cgv", $attributes)    )->toString();    $pane_form['marketplace_terms_and_conditions'] = [      '#type' => 'checkbox',      '#default_value' => FALSE,      '#title' => $this->t('I have read and accept @terms.', ['@terms' => $link]),      '#required' => TRUE,      '#weight' => $this->getWeight(),    ];    return $pane_form;  }}我的自定义模块出了什么问题以及如何解决该问题?谢谢
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 84 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信