yii2 icon indicating copy to clipboard operation
yii2 copied to clipboard

Add methods to normalize tag attributes in Html helper

Open WinterSilence opened this issue 3 years ago • 4 comments

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

WinterSilence avatar Dec 19 '21 23:12 WinterSilence

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.

yii-bot avatar Dec 20 '21 06:12 yii-bot

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

WinterSilence avatar Dec 20 '21 09:12 WinterSilence

@yii-bot need review

WinterSilence avatar Mar 16 '22 15:03 WinterSilence