You are here

public function NumberTestForm::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 FormInterface::buildForm

File

modules/price/tests/modules/commerce_price_test/src/Form/NumberTestForm.php, line 20

Class

NumberTestForm

Namespace

Drupal\commerce_price_test\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['number'] = [
    '#type' => 'commerce_number',
    '#title' => $this
      ->t('Amount'),
    '#default_value' => '99.99',
    '#min' => 2,
    '#max' => 100,
    '#required' => TRUE,
  ];
  $form['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Submit'),
  ];
  return $form;
}