public function LayoutContainer::form in Webform Layout Container 8
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/ LayoutContainer.php, line 40
Class
- LayoutContainer
- Provides a 'layout container' type element to Webform.
Namespace
Drupal\webform_layout_container\Plugin\WebformElementCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
$form['layout_container'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Alignment settings'),
'#open' => TRUE,
];
$form['layout_container']['align'] = [
'#type' => 'select',
'#title' => $this
->t('Alignment'),
'#description' => $this
->t('Controls how elements are arranged in this container. Choose "horizontal" to create a row, or "equal width" to create a row with equal column widths. The "vertical" option can be used to make columns within a horizontal box.'),
'#options' => [
'horiz' => $this
->t('Horizontal'),
'equal' => $this
->t('Equal Width'),
'vert' => $this
->t('Vertical'),
],
'#required' => TRUE,
];
return $form;
}