You are here

function webform_cards_form_webform_settings_submissions_form_alter in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_cards/webform_cards.module \webform_cards_form_webform_settings_submissions_form_alter()

Implements hook_form_FORM_ID_alter() for webform settings submissions.

See also

\Drupal\webform\EntitySettings\WebformEntitySettingsSubmissionsForm

/admin/structure/webform/manage/{webform}/settings/form

File

modules/webform_cards/webform_cards.module, line 491
Provides a 'Card' container element for clientside multistep form pagination.

Code

function webform_cards_form_webform_settings_submissions_form_alter(array &$form, FormStateInterface $form_state) {
  $has_cards = _webform_cards_form_state_has_cards($form_state);
  if ($has_cards) {
    $form['draft_settings']['draft_container']['draft_auto_save']['#default_value'] = 0;
    $form['draft_settings']['draft_container']['draft_auto_save']['#disabled'] = TRUE;
    $form['draft_settings']['draft_container']['draft_multiple']['#weight'] = -1;
    $form['draft_settings']['draft_container']['draft_auto_save_message'] = [
      '#type' => 'webform_message',
      '#message_message' => t('The automatic saving of drafts is not supported by cards. Please try using the <a href=":href">Webform autosave module</a>.', [
        ':href' => 'https://www.drupal.org/project/webformautosave',
      ]),
      '#message_type' => 'info',
      '#message_close' => TRUE,
      '#message_storage' => WebformMessage::STORAGE_SESSION,
      '#message_id' => 'webform_card_draft_auto_save',
      '#weight' => 0,
    ];
  }
}