I own a Drupal 8.7 site with the Drupal Commerce 2.14 module.
I have created a marketplace (several merchants on the same site). In the business type, I created a field "Text (formatted, long)" with the computer name
In this field, the trader specifies his general conditions of sale, which the customer must accept during the ordering process.
If the customer orders in multiple stores, multiple shopping carts are created (the name of the store is displayed above each cart). It works very well. Now that Drupal Commerce manages the address book, orders are very fast.
At the moment I have created a view that shows the content of the field
field_terms_and_conditions on one side. I've also created a custom module to display a checkbox with a link to the general sales conditions in a modal window.
I want to render the field directly
field_terms_and_conditions in the modal window without using a view. How do you do that ?
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; } }