You are here

function autosave_form_test_form_alter in Autosave Form 8

Implements hook_form_alter().

File

tests/modules/autosave_form_test/autosave_form_test.module, line 9

Code

function autosave_form_test_form_alter(&$form, FormStateInterface $form_state, $form_id) {
  if (isset($form[AutosaveFormInterface::AUTOSAVE_ELEMENT_NAME])) {
    $form[AutosaveFormInterface::AUTOSAVE_ELEMENT_NAME]['#submit'][] = 'autosave_form_test_autosave_submit';
  }
  if (\Drupal::state()
    ->get('disable_html5_validation')) {

    // Disable HTML5 validation.
    $form['#attributes']['novalidate'] = 'novalidate';
  }
}