Add a class in a Drupal template with attributes.addClass. Chain removeClass to drop one.
Better still, do it in a preprocess hook so the class isn't hard coded into the template.
Watch the class order. It affects starts-with CSS selectors.
#drupal #twig
Add a class in a Drupal template with attributes.addClass. Chain removeClass to drop one. Better still, do it in a preprocess hook so the class isn't hard coded into the template. Watch the class order. It affects starts-with CSS selectors. #drupal #twig
0 views
Published on 20/08/2026 07:29
Add a class in a Drupal template with attributes.addClass. Chain removeClass to drop one.
Better still, do it in a preprocess hook so the class isn't hard coded into the template.
Watch the class order. It affects starts-with CSS selectors.
#drupal #twig
1 comment
?
👉 Join WebWash Premium: https://www.webwash.net/premium/