public function CommerceAddToCartLinkViewsField::buildOptionsForm in Commerce Add To Cart Link 8
Same name and namespace in other branches
- 2.x src/Plugin/views/field/CommerceAddToCartLinkViewsField.php \Drupal\commerce_add_to_cart_link\Plugin\views\field\CommerceAddToCartLinkViewsField::buildOptionsForm()
Default options form that provides the label widget that all fields should have.
Overrides LinkBase::buildOptionsForm
File
- src/
Plugin/ views/ field/ CommerceAddToCartLinkViewsField.php, line 42
Class
- CommerceAddToCartLinkViewsField
- Defines a Views field that adds an add to cart link.
Namespace
Drupal\commerce_add_to_cart_link\Plugin\views\fieldCode
public function buildOptionsForm(&$form, FormStateInterface $form_state) {
parent::buildOptionsForm($form, $form_state);
$form['destination'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Include destination'),
'#description' => $this
->t('Enforce a <code>destination</code> parameter in the link to return the user to the original view upon completing the link action. Most operations include a destination by default and this setting is no longer needed.'),
'#default_value' => $this->options['destination'],
];
$form['quantity'] = [
'#type' => 'number',
'#title' => $this
->t('Quantity'),
'#description' => $this
->t('Quantity to add to cart.'),
'#default_value' => $this->options['quantity'],
];
$form['combine'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Combine cart items'),
'#description' => $this
->t('Combine multiple added products (if checked), or make separate cart items (unchecked).'),
'#default_value' => $this->options['combine'],
];
}