public function VerticalTabs::form in Webform 6.x
Same name and namespace in other branches
- 8.5 src/Plugin/WebformElement/VerticalTabs.php \Drupal\webform\Plugin\WebformElement\VerticalTabs::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/ VerticalTabs.php, line 122
Class
- VerticalTabs
- Provides a hidden 'vertical_tabs' element.
Namespace
Drupal\webform\Plugin\WebformElementCode
public function form(array $form, FormStateInterface $form_state) {
$form = parent::form($form, $form_state);
unset($form['element']['title']['#required']);
$form['vertical_tabs'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Vertical tabs settings'),
'#open' => TRUE,
];
$form['vertical_tabs']['vertical_tabs_message'] = [
'#type' => 'webform_message',
'#message_type' => 'info',
'#access' => TRUE,
'#message_message' => $this
->t("To add details and fieldsets this vertical tabs element, you must defined a custom <code>'#group': vertical_tab_key</code> property in the details or fieldset element with this vertical tabs' element key."),
'#message_close' => TRUE,
'#message_storage' => WebformMessageElement::STORAGE_SESSION,
];
$form['vertical_tabs']['default_tab'] = [
'#type' => 'textfield',
'#title' => $this
->t('Default tab'),
'#description' => $this
->t('The default tab must be the [id] attributes of the details or fieldset element.'),
];
return $form;
}