2 * Implements hook_form_FORM_ID_alter().
4 function {{ machine_name }}_form_FORM_ID_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
5 // Modification for the form with the given form ID goes here. For example, if
6 // FORM_ID is "user_register_form" this code would run only on the user
9 // Add a checkbox to registration form about agreeing to terms of use.
10 $form['terms_of_use'] = [
11 '#type' => 'checkbox',
12 '#title' => t("I agree with the website's terms and conditions."),