Reputation: 41
i'm new on drupal 8 and i want to try to custom the basic template of the webform module with my own template in TWIG , SASS. I know i have to create a custom module but after read the drupal documentation , i don't know how i can do it correctly. Any one can help me ? i try to create a module with this code
function webform_example_form_alter(&$form, &$form_state, $id) {
if ($id == 'webform_submission_contact_form') {
$form['elements']['name']['#title'] = t('Name');
}
}
Upvotes: 2
Views: 9643
Reputation: 206
Your code example makes perfect sense to me.
You can also use hook_form_BASE_ID_alter(), which for the Contact form would be webform_example_form_webform_submission_contact_form_alter().
Upvotes: 3