You are here

public function AddToCartForm::buildForm in Commerce Core 8.2

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides EntityForm::buildForm

1 call to AddToCartForm::buildForm()
BigPipeAddToCartForm::buildForm in modules/cart/tests/modules/commerce_cart_big_pipe/src/Form/BigPipeAddToCartForm.php
Form constructor.
1 method overrides AddToCartForm::buildForm()
BigPipeAddToCartForm::buildForm in modules/cart/tests/modules/commerce_cart_big_pipe/src/Form/BigPipeAddToCartForm.php
Form constructor.

File

modules/cart/src/Form/AddToCartForm.php, line 169

Class

AddToCartForm
Provides the order item add to cart form.

Namespace

Drupal\commerce_cart\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);

  // The widgets are allowed to signal that the form should be hidden
  // (because there's no purchasable entity to select, for example).
  if ($form_state
    ->get('hide_form')) {
    $form['#access'] = FALSE;
  }
  return $form;
}