Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The code for these forms is output in definition lists, which seems like overkill and ends up being problematic for themers that style definition lists.
IMO, they should be removed and output as like any other form for consistency, and we could shed all of this code:
system-behaviors.css
/**
* Multiselect form
*/
dl.multiselect dd, dl.multiselect dd .form-item, dl.multiselect dd select {
font-family: inherit;
font-size: inherit;
width: 14em;
}
dl.multiselect dt, dl.multiselect dd {
float: left; /* LTR */
line-height: 1.75em;
padding: 0;
margin: 0 1em 0 0; /* LTR */
}
dl.multiselect .form-item {
height: 1.75em;
margin: 0;
}
node.css
/* Override the default multiselect layout in system-behavior.css. */
#node-admin-content dl.multiselect dd, dl.multiselect dd .form-item {
width: 20em; /* 6em label + 14em select */
}
#node-admin-content dl.multiselect dd .form-item label {
display: block;
float: left; /* LTR */
width: 6em;
font-weight: normal;
}
user.css
/* Override the default multiselect layout in system-behavior.css. */
#user-filter-form dl.multiselect dd, dl.multiselect dd .form-item {
width: 20em; /* 6em label + 14em select */
}
#user-filter-form dl.multiselect dd .form-item label {
display: block;
float: left; /* LTR */
width: 6em;
font-weight: normal;
}
Comment | File | Size | Author |
---|---|---|---|
#98 | 732914-98.patch | 557 bytes | mgifford |
#93 | 732914-93.patch | 978 bytes | pbz1912 |
#90 | argh.png | 19.94 KB | Jacine |
#90 | 732914-90.patch | 1.13 KB | Jacine |
#80 | translate-interface.png | 18.22 KB | Jacine |
Comments
Comment #1
JacineEven it it's too late for the markup, the CSS can and should be improved here, to at least fix the floating issues they cause. See #676800: Fieldsets break design badly
Comment #2
cosmicdreams CreditAttribution: cosmicdreams commented@Jacine: This patch does what you suggest. Testing it now.
Comment #3
cosmicdreams CreditAttribution: cosmicdreams commentedHere's a sample of what happens to the fieldset once those styles are removed. If I'm reading you OP correctly, you are saying that the responsibility of rendering these form elements properly should fall onto the theme's shoulders. Do I have that right?
Comment #4
Jacine@cosmicdreams - Thanks for getting on this so fast and for the screenshot :)
I am hoping to actually remove the DL markup & CSS, and then wrap the form items using .container-inline, so the only visual difference would be the button at the bottom of the form.
Comment #5
cosmicdreams CreditAttribution: cosmicdreams commentedFor Seven there is also a lot of css in style.css that effects these definition lists. Should that stay?
Comment #6
JacineNope, it should go.
That's why I bring up this issue. Most themes end up having to massaging this code, because it's not really flexible. I don't think themes should have to do anything at all for this to work properly.
The hope is to remove all of it, and let the default form styling (.container-inline, .form-item) handle it.
Tagging this needs design review so hopefully we can get more themers on it to chime in with feedback ;)
Comment #7
sunKill the #theme functions, to start with.
Second, #type = container around the list of enabled filters and around the form to enhance the filter.
Third, #field_prefix is now allowed on all form elements (or is my patch still in the RTBC queue?), so the select list labels _could_ be output with that. OTOH, looking at that form, I see a pure two-col form layout. Theming 101 :P
Due to the container of "second", the form actions can float around the filters form items.
Comment #8
cosmicdreams CreditAttribution: cosmicdreams commentedUsing Firebug: I was able to test out your idea. I'll post the code an a snippet of how it looks below:
Comment #9
sunStarting point.
1) Same needs to be applied to User admin filter form.
2) Search for .multiselect across core and nuke/adapt everything.
3) Filter form actions may need minimal margin tweaking to be horizontally in line with first select list. Ideally, we apply an additional class to the container + apply some special CSS here, so we do not duplicate the same PHP/CSS code...
Comment #10
seutje CreditAttribution: seutje commentedsubscribe
Comment #12
sunIs anyone able to continue here? I'd be happy to assist. However, I've already mentioned in IRC that I have little interest in this patch myself (aside from the very nice clean-ups), because I'm using the admin_views module that ships with admin_menu, which replaces those pages entirely with dynamic, ajaxified Views + VBO.
1) Rename to "Two column form layout".
2) These styles are totally unrelated to JavaScript behaviors. If there is a system.css, let's move the new styles in there.
Powered by Dreditor.
Comment #13
Jacine@sun If no one else gets to it before me, I'll be giving it a shot over the weekend.
Comment #14
JacineOk, here's my attempt at this. Notes:
'#prefix' => ($i ? '<div class="additional-filters"><em>' . t('and') . '</em> ' . t('where') . '</div>' : ''),
I'm not sure if checking$i
here is correct, but it doesn't work with:!empty($form['filters']['current'])
What still needs to be done:
BTW, cross browser and theme (garland/stark/seven) testing has been done and it's looking good to me. I'll post some screenshots.
Comment #15
JacineOh, and maybe you guys can explain to me why I can't do:
$output .= drupal_render($form);
but, instead I need to specifically do:
That was a serious WTF moment for me, so I would appreciate some guidance there. Thanks. :)
Comment #16
sundrupal_render_children() is your friend. If you are stuck, the best recommendation I can give is simply to lookup similar stuff in Drupal core. (That's how I learned about drupal_render_children() myself ;) Probably not the best example, but: http://api.drupal.org/api/function/theme_filter_admin_format_filter_order/7
Comment #17
JacineOh, ha! :D Thank you @sun.
I did look around (not enough obviously), and tried
drupal_render(element_children($form));
:PUpdated patch attached.
Comment #18
sunCode review. Didn't apply the patch and look at the actual output yet.
Wrong indentation.
We have to remember to put back corresponding RTL styles into system-rtl.css.
We can remove those .form-layout-twocol classes with this approach.
1) Not sure whether this doesn't rather belong into the theme function? Entirely not sure though. Perhaps not.
2) t() should contain the entire phrase - inline markup is allowed. Otherwise, translators have no chance to translate these words for this context. (The DIV doesn't count as inline markup of course)
btw, do we also have an admin.css? This stuff only appears on administrative pages, so actually admin.css would make the most sense... (if I'm not mistaken, then system.css is loaded unconditionally for all pages)
Powered by Dreditor.
Comment #19
JacineYay, ok. Here's another patch.
I was on the fence about the additional filters text being in the theme function vs. the form too, but with themes being able to alter this, the form_alter might be easier. Especially if you only want to affect 1 of the forms. Either way seems fine to me though, so I trust whatever you think it best.
Updated todo list:
Comment #20
sunThank god we talked about theme overrides just before... this should be
See http://api.drupal.org/api/function/theme/7 for details.
Actually, it's a fragment of a form, i.e. a partial form structure. Not sure how that is described elsewhere, but yeah, let's look elsewhere ;)
I don't think that @return is required here.
This !empty() will always be TRUE due to form_builder(). We can simply remove it, element_children() will take care for the rest.
Duplicate newline.
This should not happen :)
144 critical left. Go review some!
Comment #21
JacineOops. Ok:
exposed_filters__node
andexposed_filters__user
FYI, regarding the function docs, I found that standard (which is still under discussion) here: #716496: Theme functions group needs some updates in this comment. I'll look around and see if I can find anything though.
Comment #23
JacineRe-roll. Maybe the testbot will like this one?
Comment #25
sunHelping you out a bit.
Comment #26
aspilicious CreditAttribution: aspilicious commentedTested on my browsers...
RTBC
Comment #27
aspilicious CreditAttribution: aspilicious commentedThere isn't enough space between the dropdown boxes after patch (see screens in #26)
EDIT:
role, permission, ... are bold after patch
Comment #28
Jacine@sun Thanks so much for the help with the testing stuff. How did you know I was lost on it? ;)
@aspilicious You are awesome! Thanks for pointing that out. :)
I think this was a Seven-specific issue. I'll fix it tonight.
Comment #29
sun@jacine: I had my second training session in telepathy last week. Glad that your thoughts crossed my mind.
Comment #30
Jacine@sun hehe ;) I am glad too!
Ok, here's an updated version that fixes the margins and the label.
Comment #31
JacineOh man, this still needs RTL love. Who can help with that?
Comment #32
sun@jacine: Just enable Locale module, add the "English" language one more time, edit that new language, and set it to RTL -- and you'll see the "switched" output.
Comment #33
aspilicious CreditAttribution: aspilicious commentedEverthing looks good now, and in #32 works this is rtbc (leave this to jacine).
In the IE screen you see that some buttons are way to close to a drop down box.
But that was also before the patch, so that's an other issue!
Comment #34
aspilicious CreditAttribution: aspilicious commentedForgot screenshots...
Comment #35
sunCan someone test with a RTL language setting (see #32 for how to) and mark this RTBC?
Comment #36
aspilicious CreditAttribution: aspilicious commentedThis one is rtbc I tested it. Same screenshots as #34 but in mirror view.
I found an rtl error but I don't think it's related.
Do I have to open new issue? (screenshot)
Comment #37
JacineHere's a reroll w/RTL support. Testing in Garland revealed an issue with the code when filters are applied. The filter value needs to be in a
<strong>
.I fixed this by doing:
'#markup' => '<strong>' . check_plain($value) . '</strong>',
If that's wrong, let me know. Here's the updated patch and a before and after screenshot.
Comment #38
sun1) TBH, all of those text formattings always confused me. No idea why "and" is always emphasized, the property too + bold on top, and the value only bold... ?
Can we remove those formattings and just use %-placeholders in the t()-strings? %-placeholders are triggering http://api.drupal.org/api/function/drupal_placeholder/7, so we could style them differently, if needed. Most probably, it would make sense to remove the italics and just make 'em bold.
2) The list bullets in the "after" shots do not look like Garland's list bullets (as in the "before" shots). Intentional? Not sure whether that's a good idea.
Comment #39
JacineOk... #1 has always bugged me too. I wasn't sure I should touch it, but it's fixed now and looking much better.
#2 - I didn't even notice that until you pointed it out, but it allows us to fix another annoyance. The difference is that the list was hard-coded before, and now it's being run through theme_item_list() which is kinda broken in Garland.
system.css has:
garland style.css has:
So, the disc, which is totally asinine to declare in the first place wins. I don't know if you want to do that here or not, so there are 2 versions of this patch attached. 732914-39-b leaves system.css alone.
Comment #41
JacineUgh, sorry... forgot to take my @override out.
Let's try this again.
Comment #43
sunStill an EM here.
The test assertions need to be updated. ;)
Can we remove that? (no consensus reached yet)
Wrong indentation.
I'm not a fan of wildcard overrides like this + subsequent re-overrides of the previous overrides. In themes, we can do that, but I'd prefer to avoid it in default/module CSS.
Why does this need a width? Same question for overflow?
TBH, this looks a bit awkward. Can't we target the current filters a bit more precisely?
(is this also the reason for the overrides mentioned earlier?)
Actually, I'd prefer to remove this styling altogether. Stark can rely on browser default styling, and for every theme out in the wild, styles like this get horribly in the way. We can do this change here, but should definitely create a follow-up to fix system.css.
aha! We don't apply a class for the current filters yet.
140 critical left. Go review some!
Comment #45
JacineOk, here's another try at this. I don't know if the test stuff is right. A width is needed because of IE, overflow is not so that's gone. I also removed this since it's not having any affect as we are making this output in a list and added a current-filters class to the theme function:
Hopefully this addresses everything above.
Comment #47
JacineForgot one more EM. The patch failed testing, so this one will too. I don't get it.
Comment #49
sunThis one should come back green.
I've additionally streamlined the markup and CSS a bit. Feel free to yell at me. ;)
Comment #50
cosmicdreams CreditAttribution: cosmicdreams commentedSo far this looks like an improvement. Testing in Safari we see that /admin/content's dropdowns have a clear seperation. When the dropdowns are selected a very visible highlight of the field is present. However, /admin/reports/dblog needs a better seperation of the two multi-select boxes (Type and Severity). There is no visible gap between them (see: selection_017.png)
Comment #51
sunThat reports filter form is not touched by this patch, sorry. :)
EDIT: And shouldn't/couldn't, as it's using a different structure/workflow.
Comment #52
sunRTBC, anyone?
Comment #53
JacineWhat is the point of this?
That clearfix class doesn't end up used as far as I can tell, and if I really wanted to modify this I would have to deal with both the theme function AND the form. The additional filters part seems like it belongs in the theme function.
Also, re: the width on .filters have you tested on IE6? If I'm wrong, fine, but I remember double-checking and it being an issue. Anyway, I'll look again tonight.
Comment #54
sunYay, that almost sounds like yelling :)
.clearfix is used to clear the float that is applied to align the buttons next to the additional filters.
If we want to separate the additional filters text prefix, then it should simply be added as new, first subkey:
Comment #55
JacineNo, this is fine, and I guess I was wrong about needing the width on filters (sorry), though it's still making me a feel a bit crazy.
Only thing that was wrong in the patch (and it's my probably my fault for forgetting it in my last patch) is the theme_node_filters() function not being removed. This reroll just takes care of that and doesn't change anything else. I think it's ready.
Comment #56
cosmicdreams CreditAttribution: cosmicdreams commentedI'm not sure if this is something this patch should be concerned with but I'm just going to post it here anyways. In IE7, on admin/content, the buttons seem inconsistent in their design. one button is flush with the right side of a select box the other is not. See screenshots.
Testing the rest...
Comment #57
cosmicdreams CreditAttribution: cosmicdreams commentedThis issue seems to work well for Safari (on windows). Good improvement.
Comment #58
Jacine@cosmicdreams Thanks for testing. The issue you bring is not related. Capture 2 is all we are messing with here.
Comment #59
cosmicdreams CreditAttribution: cosmicdreams commentedI've tested firefox 3.6, Opera 10.51, IE 6, 7, and 8, and Safari 4. The only issue I found for the area of the page that Capture2.png shows is with IE 6. See the screenshot I attached.
There doesn't seem to be a major issue with IE6, perhaps the area that these fields need can be widened for IE6.
Comment #60
cosmicdreams CreditAttribution: cosmicdreams commentedpatch doesn't apply anymore. Here's the content of the .rej file:
I tried to reroll this patch myself but it's those last two lines that have me confused. The theme_user_filters function is at the end of the page. It seems like in this patch it isn't and i'm not sure if I simply need to remove the the theme_user_filters function or if there is more that needs to be done.
Comment #61
retester2010 CreditAttribution: retester2010 commented#55: 732914-55.patch queued for re-testing.
Comment #63
JacineHmm, this is actually why I had a width set in CSS, but Sun said we didn't need it. I will try to reroll this by this weekend.
Comment #64
sunOh dear, I thought this was in already.
Re-rolled against HEAD. (only, no other changes)
Comment #65
RobLoachThis patch makes my brain explode from too much awesome.
Comment #66
reglogge CreditAttribution: reglogge commentedThis works beautifully. Especially nice that the width of the labels is now increased to 10em (was only 6em before) which solves problems for translated installs where 6em was sometimes to narrow.
Tested in Safari (Mac), FF (Mac, Windows), IE7
Comment #67
JacineI need to add a width to fix the issue described in #59. After that this will be ready. I'm going to work on this right now.
Comment #68
JacineOk, width added back and tested for IE6. Screenshot of IE6 attached. I think this is ready.
Comment #69
reglogge CreditAttribution: reglogge commentedThe width of 22em for
.exposed-filters .filters
in admin.css is too small since.exposed-filters .form-item
label has 10em and.exposed-filters .form-select
has 14em. We need 25em for.exposed-filters .filters
since.exposed-filters .form-select
also has 2px padding.Otherwise select boxes are positioned below the label.
Patch attached.
Comment #70
JacineYeah, you're right. Thanks for the review and for re-rolling the patch :)
Comment #71
sunThanks!
This is an awesome clean-up. Removes more lines than it adds, and improves the situation while doing so. I think this is ready to fly. If there are any remaining issues, we can deal with them in follow-ups.
Comment #72
sunJust saw that this patch is still sitting in the queue. Still ready to go in, doesn't break anything, but allows modules (if they want) to remove lots of duplicate code.
Comment #73
reglogge CreditAttribution: reglogge commentedJust for reviewers two screenshots showing the filter select controls on admin/content as an example. Note the added margins between the selext controls in after.png.
This even works in IE6.
The patch is a simple reroll aginst current HEAD since the patch from #69 didn't apply cleanly anymore.
Comment #74
Jacine@regelogge It worked in IE6 all along. We did a LOT of testing. What changes did you make in the latest reroll?
Comment #75
reglogge CreditAttribution: reglogge commentedNo changes in code against #69 at all, just the reroll since the patch in #69 didn't apply cleanly anymore against today's HEAD.
Comment #76
JacineGreat, thank you :) New patches need to be reviewed though. Let's make sure the bot is all good with it and I'll give it a test again as well.
Comment #77
JacineOk, it's all good. Back to RTBC. Thanks again for re-rolling @reglogge!
Comment #78
Jeff Burnz CreditAttribution: Jeff Burnz commentedThis is a great patch and one that really should go through - I just found an odd situation when Locale module is enabled and the front end theme and admin theme are the same theme - locale loads some CSS that restricts the width of the form-item to just 15em, so it wraps. If we add a width: auto; to .exposed-filters .form-item we can negate this ever happening.
Comment #79
reglogge CreditAttribution: reglogge commentedI can't reproduce the problem from #78.
I tried with Bartik and Garland both enabled as front end and admin theme at the same time. Locale module is enabled. Seems that in my install (fresh checkout from today) locale.css doesn't get loaded for these pages like /admin/content at all.
Did you test this with the latest HEAD? If so, can you describe more exactly the steps you took to arrive at this situation?
Comment #80
JacineWow, good catch Jeff. That is totally buried, and I'd actually call it a bug with the locale module's CSS. It seems to me that entire form should be converted to use the code we are using in this patch, as it is yet another filter form that seems to be using better markup, but some of the original CSS used for the user and content filter forms we are fixing here.
I tracked down what that actual code is for. It's on this page: admin/config/regional/translate/translate. I've attached a screenshot of the filter form in question. What do you guys think?
Comment #81
Jeff Burnz CreditAttribution: Jeff Burnz commentedFrom what i can tell locale.css is only meant to load on admin/config/regional/translate/translate but I don't really have the time to dig into Locale and figure out why or when this loads - from what i can tell I have English as my default language and Arabic and Swedish installed as well. Apart from that I can't tell you much more. I always run patches against latest head - don't you ;)
EDIT - yes Jacine, I would say its a bug also, I can't see anywhere or why this CSS would load ever for the Content Pages.
Comment #82
JacineOk, we need to file a bug against the locale.css for that. It would be nice to convert that form to use theme_exposed_filters() in this patch, but since it would mean a significant change in the UI, and this patch does not change the UI, it should be taken care of separately.
FTR, while I believe that it's happening, I also cannot reproduce this. I tried with all the core themes, using the same front end and backend theme, with locale enabled, 3 languages set, and content in each of them and I'm not seeing the problem.
Setting this back to RTBC.
Comment #83
Jeff Burnz CreditAttribution: Jeff Burnz commentedJust out of interest are you guys using Overlay? I wasn't, but when I turned on the Overlay the issue went away.
Comment #84
JacineI was using Overlay at first, but I tried to trigger this without it as well.
Comment #85
Jeff Burnz CreditAttribution: Jeff Burnz commentedOK, I posted as issue against Locale #914194: locale.css loaded and applied on other pages and elements - but I still think we should add width:auto; as this seems pretty fragile without it.
Comment #86
JacineI dunno. I'm not thrilled about adding excess in brand spanking new CSS, just because it might get broken.
Comment #87
Dries CreditAttribution: Dries commentedCommitted to CVS HEAD. Thanks.
Comment #88
JacineAwesome! Thank you Dries ;)
I cannot wait to point out that this has been fixed when I hear the next person complaint about it.
Comment #90
JacineI ran into a problem with this today, as shown in the screenshot, by setting a line-height: 2em on label.
We basically need to clear the float for the label, but don't have an easy way of doing that since we cannot affect the classes on the form element wrapper, so here's a patch that uses inline-block for that label instead. I think it's better because it removes the need for the RTL code (it even works fine in IE because the label has a width).
Comment #91
Jacine#90: 732914-90.patch queued for re-testing.
Comment #92
JacineComment #93
pbz1912 CreditAttribution: pbz1912 commentedPatch in #90 didn't apply any more as core moved to core/ folder.
I have recreated the patch. Just needs testing.
Comment #94
Manjit.Singh93: 732914-93.patch queued for re-testing.
Comment #96
Manjit.Singh93: 732914-93.patch queued for re-testing.
Comment #98
mgiffordReroll..
Comment #100
LewisNymanComment #102
mgiffordThe patch is just CSS so the errors don't make sense to me.
Comment #103
idebr CreditAttribution: idebr commentedThe theme function for Exposed filters has been removed in Drupal 8 in favor of Views exposed filters in #2087239: Remove theme_exposed_filters(). The CSS is no longer in use since it has been abstracted into new class
.form--inline
in #2333719: Abstract Views Exposed Form styling out into a reusable class, so this issue is only relevant for D7