Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By neha.gangwar on
I am trying to design contact form template in drupal 8. I successfully added form-contact-message-contact-form.html.twig template file. Here i can add simple classes in my form. But i not getting how to add prefix/suffix, classes in my form field for designing my form.
Any suggestions ??
Comments
hook_form_alter() and the
hook_form_alter() and the Form API.
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
yes i did the same
But i think there will be some good solution instead of form alter. Now i need to design Email template for contact form. In my contact form i have not used default fields. I have added new fields as per my requirement. Implemented hook_mail_alter to alter email template but not getting how to print additional form elements. In drupal 7 we did something like this -
$message['params']['field_name_here']
. So how can we achieve the same in D8.Fixed it!
Yes i got the solution. Might be useful for anyone.
This is giving me all the fields values of Contact form.
Hi, is there a twig template
Hi, is there a twig template way to access form element and style them?
I did try form--personal.html.twig, but no success.(personal is id for default contact form)