In some situations, we need to manage the structure of the fields in a custom form; this management makes it easier for the Frontend to style the form structures. So, if what we want is to render or display each specific field of a form in a custom TWIG template, these are the steps:
For this example, we'll use a dummy module: modules/custom/example_fields_form
Creating the module example_fields_form.info.yml:
type: module name: example_fields_form description: 'some description' core: 8.x
With our module in place, we need to create a routing file, which will be responsible for calling and executing our form with a basic content access requirement. To do this, we will create the file example_fields_form.routing.yml: