0

I am trying to create a block (that I can reuse in different templates and pages)that shows taxonomy terms (for a specific vocabulary).

I have already created a view to get the term list, and started overriding twig files to modify the display of the view. I modified the following files so far:

  • block--views-block.html.twig
  • views-view-fields.html.twig

The idea is to implement a bootstrap layout where the "row" div is on the first file and the "col" divs are in the second one.

Overriding those files is working but the layout breaks because there is a lot of unwanted code rendering. For example, the code generated by:

  • core/modules/system/templates/container.html.twig
  • core/modules/views/templates/views-view.html.twig

Which as I understand I can't override and I shouldn't modify (because they are in /core).

How can I get rid of all the unwanted code those files generate?

0

Sounds like you should enable template file suggestions in your site, this will help you to identify the right target name for a template to override the core files. You can read more about this feature in the docs at https://www.drupal.org/docs/8/theming/twig/locating-template-files-with-debugging

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.