如何在购买渠道中显示商店的渲染实体?

问题描述

我创建了一个链接,该链接在模式窗口中显示与购物车相关的商店的“条款和条件”。

链接链接到模式窗口中的页面

我想用cgv显示模式(这是我的商店类型中显示模式的机器名称)替换商店的渲染实体渲染的页面

我应该更改我的代码吗?

my_module / src / Plugin / Commerce / CheckoutPane / MarketplaceTermsAndConditions.PHP

<?PHP

namespace 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;

class MarketplaceTermsAndConditions extends CheckoutPaneBase implements CheckoutPaneInterface {

  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;
  }

}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)