-
Notifications
You must be signed in to change notification settings - Fork 38
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
[DX] Provide an easy way to specify attributes for the wrapper div in the output of theme_item_list()
#6148
Comments
them_item_list()
theme_item_list()
I have come across this need again while working on #6290 and other related issues. Instead of being able to simply target the list with something like this and be done with it for the entire theme: .task-list.item-list {
width: 100%;
} (where .installer-browser-install-tasks .item-list,
.maintenance-page .tasks .item-list,
...
.add .more-classes .tasks .item.list,
...
.in-every .page-you-want .tasks .item.list {
width: 100%;
} ...and sometimes, there is no container element available in order to target the |
I think I've come across this situation, too, so I'd support this. And I see that FAPI |
Reviewing the code, I see that |
Tested, WFM. Code is tentatively LGTM, just wondering about the point above. If it's a Task, then that sounds like a bugfix milestone. |
Thanks @bugfolder 🙏🏼
For now, I've updated the
I only changed that inline comment because PHPCS was complaining about the In the meantime, I have rebased, and fixed the tests - only the |
Jiminy, I hate to quibble over text, but since our standard for HTML is to lower-case tags, upper-casing them when we talk about them seems wrong. I think you have the right solution to the "Don't start a comment with a lower-case" rule, though; saying (And if CSpell complains about |
I've made my above suggestion a comment on the PR. Looking through the failing tests, they're irrelevant, so @klonos, if you're willing to go back to LC on tbody and tfoot by accepting the suggestion, I can mark this WFM and RTBC. |
Code re-reviewed. LGTM! RTBC. (Only failing tests are our old friend |
I think this looks good too! Only problem is this isn't a UX or bug fix so it should probably be a 1.27.0 issue rather than 1.26.2. I updated the |
I merged backdrop/backdrop#4458 into 1.x for 1.27.0. Thanks @klonos and @bugfolder! |
Thanks @quicksketch 🙏🏼 @bugfolder how do we update https://docs.backdropcms.org/form_api with this change again? |
...scratch that. We didn't add that to any FAPI element - just a theme_* function. All good 👍🏼 |
Consider this code:
The output of the above implementation of
theme('item_list', ...)
looks like this:I was going through the comments in https://api.drupal.org/api/drupal/includes%21theme.inc/function/theme_item_list/7.x and there are many comments to ask how to add a class, id, or other property to the wrapper div, because CSS doesn't have a way to target parents - see: https://stackoverflow.com/questions/1014861/is-there-a-css-parent-selector
So, each time that someone asks how to add an attribute to the wrapper
<div>
of the list, the answer is that you have to write a customMYTHEME_item_list()
function. DX 👎🏼Instead of having the output of that wrapper
<div>
be hard-coded, I would like to propose that we introduce a new 'wrapper_attributes' property intheme_item_list()
, to allow for this to happen:...so that people can achieve the following output without having to write custom theme functions:
The text was updated successfully, but these errors were encountered: