You are here

public function WebformFlexbox::form in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformElement/WebformFlexbox.php \Drupal\webform\Plugin\WebformElement\WebformFlexbox::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 ContainerBase::form

File

src/Plugin/WebformElement/WebformFlexbox.php, line 53

Class

WebformFlexbox
Provides a 'flexbox' element.

Namespace

Drupal\webform\Plugin\WebformElement

Code

public function form(array $form, FormStateInterface $form_state) {
  $form = parent::form($form, $form_state);
  $form['flexbox'] = [
    '#type' => 'fieldset',
    '#title' => $this
      ->t('Flexbox settings'),
  ];
  $form['flexbox']['align_items'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Align items'),
    '#options' => [
      'flex-start' => $this
        ->t('Top (flex-start)'),
      'flex-end' => $this
        ->t('Bottom (flex-end)'),
      'center' => $this
        ->t('Center (center)'),
    ],
    '#required' => TRUE,
  ];
  return $form;
}