function webform_cards_form_webform_settings_form_form_alter in Webform 8.5
Same name and namespace in other branches
- 6.x modules/webform_cards/webform_cards.module \webform_cards_form_webform_settings_form_form_alter()
Implements hook_form_FORM_ID_alter() for webform settings form.
See also
\Drupal\webform\EntitySettings\WebformEntitySettingsGeneralForm
/admin/structure/webform/manage/{webform}/settings/form
File
- modules/
webform_cards/ webform_cards.module, line 391 - Provides a 'Card' container element for clientside multistep form pagination.
Code
function webform_cards_form_webform_settings_form_form_alter(array &$form, FormStateInterface $form_state) {
$has_cards = _webform_cards_form_state_has_cards($form_state);
if ($has_cards) {
unset($form['wizard_settings']['#states']);
}
_webform_cards_form_alter_elements($form, [
'wizard_settings' => [
'#title' => t('Form wizard/cards settings'),
// Progress.
'wizard_progress_bar' => [
'#title' => t('Show wizard/cards progress bar'),
],
'wizard_progress_link' => [
'#title' => t('Link to previous pages/cards in progress bar'),
'#description' => t('If checked, previous pages/cards will be link in the progress bar.'),
],
'wizard_progress_pages' => [
'#title' => t('Show wizard/cards progress pages'),
],
'wizard_progress_percentage' => [
'#title' => t('Show wizard/cards progress percentage'),
],
'wizard_preview_link' => [
'#title' => t('Link to previous pages/cards in preview'),
'#description' => t("If checked, the preview page/card will included 'Edit' buttons for each previous page/card.") . '<br/><br/>' . '<em>' . t("This settings is only available when 'Enable preview page/card' is enabled.") . '</em>',
],
'wizard_progress_states' => [
'#title' => t("Update wizard/cards progress bar's pages based on conditions"),
'#description' => t("If checked, the wizard/cards progress bar's pages will be hidden or shown based on each pages conditional logic."),
],
// Navigation.
'wizard_navigation_title' => [
'#access' => TRUE,
],
'wizard_auto_forward' => [
'#access' => TRUE,
],
'wizard_auto_forward_hide_next_button' => [
'#access' => TRUE,
],
'wizard_keyboard' => [
'#access' => TRUE,
],
// Pages.
'wizard_pages_title' => [
'#states' => [],
],
'wizard_confirmation' => [
'#title' => t('Include confirmation page/card in progress'),
'#description' => t("If checked, the confirmation page/card will be included in the progress bar."),
],
'wizard_toggle' => [
'#title' => t('Display show/hide all wizard/cards pages link'),
'#description' => t('If checked, a hide/show all elements link will be added to this webform when there are wizard/cards pages.'),
'#access' => TRUE,
],
// Labels.
'wizard_toggle_show_label' => [
'#title' => t('Wizard/cards show all elements label'),
'#access' => TRUE,
],
'wizard_toggle_hide_label' => [
'#title' => t('Wizard/card hide all elements label'),
'#access' => TRUE,
],
'wizard_start_label' => [
'#title' => t('Wizard/cards start label'),
'#description' => t('The first page label in the progress bar. Subsequent pages are titled by their wizard/card page title.'),
],
'wizard_confirmation_label' => [
'#title' => t('Wizard/cards end label'),
],
'wizard_prev_button_label' => [
'#title' => t('Wizard/cards previous page button label'),
'#description' => t('This is used for the previous page button within a wizard/cards.'),
],
'wizard_next_button_label' => [
'#title' => t('Wizard/cards next page button label'),
'#description' => t('This is used for the next page button within a wizard/cards.'),
],
// Tracking.
'wizard_track' => [
'#title' => t('Track wizard/cards progress in the URL by'),
'#options' => [
'name' => t("Page/card name (?page=contact)"),
'index' => t("Page/card index (?page=2)"),
],
],
],
]);
}