yii2
yii2 copied to clipboard
Add methods to normalize tag attributes in Html helper
Converts values of style, class, custom attributes to arrays to fix invalid merging attributes in widgets.
| Q | A |
|---|---|
| Is bugfix? | ✔️ |
| New feature? | ✔️ |
| Breaks BC? | ✔️/❌ |
| Fixed issues |
Thank you for putting effort in the improvement of the Yii framework. We have reviewed your pull request.
Unfortunately a use case is missing. It is required to get a better understanding of the pull request and helps us to determine the necessity and applicability of the suggested change to the framework.
Could you supply us with a use case please? Please be as detailed as possible and show some code!
Thanks!
This is an automated comment, triggered by adding the label pr:missing usecase.
Converts attribute arrays to unified style: data/custom, style, class attributes converts to array.
Correctly merging attribute arrays. It's useful method mix styles: long 'data-id' => 1 and short 'data' => ['id' => 1] or user pass attributes in other style than used in method:
For example, if we replace array_merge() to Html::mergeTagAttributes(), then user can set $closeButton as ['data-bs-dismiss' => 'modal', 'aria-label' => 'Close'] or as ['data' => ['bs-dismiss' => 'modal'], 'aria' => ['label' => 'Close']], method will return same results in both cases.
https://github.com/yiisoft/yii2-bootstrap5/blob/622d200cd54ea1f1b3858efe92d0433f308c0ee3/src/Modal.php#L292
@yii-bot need review