Content generated by Drupal is sometimes too wide for a particular theme's content area. Potential solution: a way to provide a maximum width setting, so that drupal-generated content (at least, that content generated programatically) would not exceed it.
For example, form elements generated through calls like form_textarea() have widths assigned. If we had a variable like content_maximum_width, we could provide a maximum width value that would override any too-wide values coming, e.g., from core modules. This would require:
- A variable, set e.g. in the core theme configuration.
- Calls in content generation (e.g., by form_ functions) adjusted to first test for maximum width setting.
Comments
Comment #1
(not verified) commentedComment #2
(not verified) commentedI really need this functionality for the theme I am creating.
I'm new to this forum format so please forgive me if I'm just missing something obvious. It says "Status:fixed." Does this mean that this functionality is now available? do I need a particular build version? Is there any documentation available on how to set this variable?
Basically, in forms(particularly the admin forms like settings) I want to
a) change all of the "
size" attributes for textinputsb) change all of the "
cols" attributes fortextareasAs I see it the best way to control the widths of these form elements, I need to
a) override the existing default values from
"70"to something like"55"(based on theme)or, (and this would be ideal)...
b) strip them out these static attributes altogether so that I can control their widths with CSS.
* My preferred way to do this would be to wrap each
formin adiv class="form-holder"that I could declare a width on with CSS. Then I could easily use descendant selectors to set.form-holder textareaand.form-holder inputtowidth:90%or whatever.Am I even in the right place to ask this question?
Comment #3
nedjoI was the poster (forgot to log in and, seemingly, set the wrong status!).
Attached is a screenshot illustrating the problem of form element width exceeding the maximum available in a theme. Since form elements are dynamically generated, it would be simple to override widths. I'd be happy to generate a patch if there's interest.
Comment #4
clairem commentedThe default sizes of 70 looks fine to me as a default, and I don't think I'd like the admin screens cluttered up with another setting for this.
The size attribute has effect only when not overridden by CSS. So why not just use CSS to set the widths to whatever you feel is appropriate for your layout?
e.g.
I'm not sure whether
width: 90%would work, but you could try it.Comment #5
nedjoOf course you're right that CSS can be used to override the default values. I'd thought of that but didn't see an easy way to get this to apply to all form content (my main concern) while still allowing variable widths. Setting
widthoverrides would make all elements the same, meaning we couldn't choose short fields. Themax-widthCSS parameter should work, but isn't supported by Internet Explorer. There are IE workarounds (using dynamic setting of the width parametter) but I don't immediately see a good one for this case.I agree that new settings should be introduced very sparingly and only when there are no good alternatives. So, perhaps, the best solution is to use
max-widthand leave it at that.Comment #6
ricabrantes commentedThis issue is active??
Comment #7
jody lynnYes, I think you should use max-width and leave it at that.