I am a newbie. I have experience working with Twig
but in Drupal it is used in another way.
I have seen a lot of code like that
<section{{ attributes.addClass(classes) }}>
And of course I read this article https://www.drupal.org/docs/8/theming-drupal-8/using-attributes-in-templates
There are a lot of examples and that is great.
But why do I need this, how could I use them to improve readability and flexebility ?
You should agree that attributes.addClass(classes)
method is doing something like adding class to the existing attributes, but not returning the output of all attributes.
Could you tell me please why this attributes variable is useful, how can I use it to provide better decoupling or whatever it is used for. Why not just to keep classes directly in a template file, is it possible to add them from admin panel ? Thanks