public function WebformHeight::form in Webform 8.5
Same name and namespace in other branches
- 6.x src/Plugin/WebformElement/WebformHeight.php \Drupal\webform\Plugin\WebformElement\WebformHeight::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
File
- src/
Plugin/ WebformElement/ WebformHeight.php, line 102
Class
- WebformHeight
- Provides a 'height' element.
Namespace
Drupal\webform\Plugin\WebformElementCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['height'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Height settings'),
];
$form['height']['height_type'] = [
'#type' => 'select',
'#title' => $this
->t('Height element type'),
'#options' => [
'number' => $this
->t('Number input'),
'select' => $this
->t('Select menu'),
'select_suffix' => $this
->t('Select menu with suffixes'),
],
];
$form['height']['height_format'] = [
'#type' => 'select',
'#title' => $this
->t('Height suffix format'),
'#options' => [
'' => $this
->t('Units (feet/foot and inches/inch)'),
WebformHeightElement::HEIGHT_ABBREVIATE => $this
->t('Abbreviated units (ft and in)'),
WebformHeightElement::HEIGHT_SYMBOL => $this
->t('Symbols (″ and ′)'),
],
];
$form['height']['feet_container'] = $this
->getFormInlineContainer();
$form['height']['feet_container']['feet__min'] = [
'#type' => 'number',
'#title' => $this
->t('Feet minimum'),
'#description' => $this
->t("Specifies the feet's minimum value."),
'#step' => 'any',
'#size' => 4,
];
$form['height']['feet_container']['feet__max'] = [
'#type' => 'number',
'#title' => $this
->t('Feet maximum'),
'#description' => $this
->t("Specifies the feet's maximum value."),
'#step' => 'any',
'#size' => 4,
];
return $form;
}