But it only shows you how to create a random variable in the controller. When I try to create a template for a custom node type in my module, it can't access the {{ content }} at all. How do I pass {{ content }} into the custom template?
But the "directory" variable seems to be set to the current theme directory rather than the module directory. So, instead, I have to link directly to the file like this:
I have a twig template with a custom layout for a specific content type. I would like the node preview to use the custom template. There does not seem to be a method for doing this. The template naming conventions do not address preview modes, and none of the file name suggestions in the twig debugging info address my particular content type. Is there a method for doing this?
I have form that is build in a custom module and using the debug mode I can see its using the core templates currently. But I need to use custom templates to theme the form and its fields. How can I make custom theme suggestions and use custom templates for some specific fields or use one custom form template and all the fields.
Hi,
I have a site on a Drupal 8. I would like to include a reference to an entity in a contact form.
I explain myself:
On each page of my 'Product' content type, I have a contact form. In my content type I have a field called "field_reference". I would like to be able to create a field in my contact form that refers to this field but that the user does not have to fill in.
If my product "A" reference is: 123
In my form I would like to have: