public function EmptyCartButton::viewsForm in Commerce Core 8.2
Builds the views form.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
File
- modules/
cart/ src/ Plugin/ views/ area/ EmptyCartButton.php, line 106
Class
- EmptyCartButton
- Defines an area handler for the "Empty cart" button.
Namespace
Drupal\commerce_cart\Plugin\views\areaCode
public function viewsForm(array &$form, FormStateInterface $form_state) {
// Make sure we do not accidentally cache this form.
$form['#cache']['max-age'] = 0;
$form[$this->options['id']]['#tree'] = TRUE;
$form['actions']['empty_cart'] = [
'#type' => 'submit',
'#value' => $this
->t('Empty cart'),
'#empty_cart_button' => TRUE,
'#attributes' => [
'class' => [
'empty-cart-button',
],
],
];
}