I have the entity degree. I created a view to represent the data of the degree. The system name of my view is data-degree. I created a twig template with name 'views-view-data--degree.html.twig'. I'm trying to represent the fields 'presentation', 'main-goal' and 'competencies' in my view. I tried many ways to do it, but the data is not rendering. I try to print dump(rows) but nothing is seen. As far as I understand, views return rows.

How could I then render these fields?

New contributor
Óscar is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Hi Óscar, welcome to Drupal Answers. First, check the name of your twig template because I think the first issue is the name of your template. When you're debugging twig issues, it can be helpful to enable twig debugging (though be careful to NOT enable it on production environments). After enabling twig debugging, you can view the page's source code and see which template is being used to render the content and it'll also list all of the available template suggestions.
    – sonfd
    Commented Jun 11 at 11:54
  • I'll add that based on the information you provided, I think you probably want to copy the views-view-fields template (or get a copy from your base theme) and name your template something like views-view-fields--data--degree.html.twig following the naming convention views-view-fields--VIEW-ID--DISPLAY-ID.html.twig
    – sonfd
    Commented Jun 11 at 12:16


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.