Tập tành add a specific css class to webforms form tag in Drupal 9
29th May 2022Code snippet that can be used to add a specific css class to webforms/forms form tag in Drupal 9
/** * @param $form * @param $form_state * @param $form_id */ function mymodule_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'webform_submission_contact_add_form') { // add class to tag <form> $form['#attributes']['class'][] = 'my-custom-class'; } }
Add new comment