I want to add a simple contact form on my page. For my whole website I use bootstrap.
What is the best approach to style it with the bootstrap classes?
I found now way yaml option in the form.md, so that I can add a custom css classes for styling for certain elements. I also found nothing in the docs regarding custom styles.
Of course I could style the existing classes in the elements, however that would require me to copy the styles of the bootstrap classes in the new classes… Nevertheless I will miss some layout classes
You could provide a custom templates/forms/field.html.twig to match your needed markup, and add classes to each form field using the classes yaml property in the form definition, see http://learn.getgrav.org/advanced/forms#fields-parameters
yeah, I did this now. Copied the field.html.twig file in my template folder and modified it.
What I found really difficult and still not really understand is, what template include what other template. There is some documentation really necessary.
In twig files you have for example: {% include “forms/data.html.twig” %} . That means you have to look for data.html.twig in templates/forms/data.html.twig or if it does not exist, then it’s inherited from plugin: user/plugins/form/templates/forms/data.html.twig . This is called inheritance. You can overwrite each file by copying it to your template directory.