Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods to normalize tag attributes in Html helper #19100

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

WinterSilence
Copy link
Contributor

@WinterSilence WinterSilence commented Dec 19, 2021

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 WinterSilence marked this pull request as ready for review December 20, 2021 00:11
@samdark samdark added the pr:missing usecase It is not clear what is the use case for the pull request. label Dec 20, 2021
@yii-bot
Copy link

yii-bot commented Dec 20, 2021

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.

@WinterSilence
Copy link
Contributor Author

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

@samdark samdark removed the pr:missing usecase It is not clear what is the use case for the pull request. label Dec 21, 2021
@bizley bizley requested a review from a team February 9, 2022 08:43
@WinterSilence
Copy link
Contributor Author

@yii-bot need review

Copy link

codecov bot commented May 30, 2024

Codecov Report

Attention: Patch coverage is 0% with 39 lines in your changes are missing coverage. Please review.

Project coverage is 19.58%. Comparing base (e1268d1) to head (b888e41).
Report is 9 commits behind head on master.

Files Patch % Lines
framework/helpers/BaseHtml.php 0.00% 39 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19100      +/-   ##
============================================
- Coverage     22.16%   19.58%   -2.58%     
- Complexity    11386    11408      +22     
============================================
  Files           430      430              
  Lines         37113    37150      +37     
============================================
- Hits           8225     7277     -948     
- Misses        28888    29873     +985     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants