There are a lot of toolkit ‘helpers’ in the docs, and I like to get a better understanding of their benefit. I’m used to code data-attributes like this
<button type="button" data-toggle="collapse" data-target="#navToggle"
aria-controls="navToggle" aria-expanded="false" aria-label="Toggle navigation">
but when checking the docs I see there is a toolkit Html::attrs
which gives the same output. Following code is from the image.php
template:
<figure<?= Html::attr(['data-ratio' => $ratio, 'data-crop' => $crop], null, ' ') ?>>
What is the benefit of using the latter?