You are here

public function NumericBase::form in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformElement/NumericBase.php \Drupal\webform\Plugin\WebformElement\NumericBase::form()

Gets the actual configuration webform array to be built.

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 An associative array contain the element's configuration webform without any default values.

Overrides WebformElementBase::form

2 calls to NumericBase::form()
Range::form in src/Plugin/WebformElement/Range.php
Gets the actual configuration webform array to be built.
WebformScale::form in src/Plugin/WebformElement/WebformScale.php
Gets the actual configuration webform array to be built.
2 methods override NumericBase::form()
Range::form in src/Plugin/WebformElement/Range.php
Gets the actual configuration webform array to be built.
WebformScale::form in src/Plugin/WebformElement/WebformScale.php
Gets the actual configuration webform array to be built.

File

src/Plugin/WebformElement/NumericBase.php, line 61

Class

NumericBase
Provides a base 'numeric' class.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $form['number'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Number settings'),
  ];
  $form['number']['number_container'] = $this
    ->getFormInlineContainer();
  $form['number']['number_container']['min'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Minimum'),
    '#description' => $this
      ->t('Specifies the minimum value.'),
    '#step' => 'any',
    '#size' => 4,
  ];
  $form['number']['number_container']['max'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Maximum'),
    '#description' => $this
      ->t('Specifies the maximum value.'),
    '#step' => 'any',
    '#size' => 4,
  ];
  $form['number']['number_container']['step'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Steps'),
    '#description' => $this
      ->t('Specifies the legal number intervals. Leave blank to support any number interval. Decimals are supported.'),
    '#step' => 'any',
    '#size' => 4,
  ];
  return $form;
}