We are looking for a way to remove all the attributes for one or more fields (if not all) when they are displayed. There is a way to do this using Twig template by removing {{ attributes.addClass }} in any twig template that has <article {{ attributes.addClass }}>, but that requires for us to do this with all fields and any twig templates.

The goal would be to have a settings globally to remove the attributes, but we have been unable to find a module that does this.

How would we without modifying twig templates, accomplish this situation?

We have a way to add custom attributes on a as needed basis.

  • 3
    There is no way that doesn't involve twig. Moving the logic for adding classes to twig means it is the only place where it can be customized. You can always create a theme that doesn't extend from classy, then you get almost no classes by default
    – Berdir
    Commented Mar 1, 2018 at 21:11

1 Answer 1


We ended up creating a field.html.twig in our custom sub theme where all the attributes were removed and only added them on an as needed basis.

Your Answer

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

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