Skip to content

Instantly share code, notes, and snippets.

@ericjgruber
Created November 1, 2019 20:56
Show Gist options
  • Save ericjgruber/1275456f921940c0aa1c829895c13356 to your computer and use it in GitHub Desktop.
Save ericjgruber/1275456f921940c0aa1c829895c13356 to your computer and use it in GitHub Desktop.
Searching for forms
/**
* Implements hook_form_alter().
*/
function HOOK_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
$formIds = [
'eform-submission-guide-request-form' // Example of a $form_id.
];
$formIds = str_replace('-', '_', $formIds); // Change the $form_id to something Drupal understands.
// Loop through any of the form ids listed in the $formIds array.
foreach ($formIds as $formId) {
if ($form_id == $formId) {
$form['#attributes']['novalidate'] = 'novalidate';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment