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.
CommentFileSizeAuthor
#3 width_overflow.png78.18 KBnedjo

Comments

Anonymous’s picture

Anonymous’s picture

I 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 text inputs
b) change all of the "cols" attributes for textareas

As 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 form in a div class="form-holder" that I could declare a width on with CSS. Then I could easily use descendant selectors to set .form-holder textarea and .form-holder input to width:90% or whatever.

Am I even in the right place to ask this question?

nedjo’s picture

StatusFileSize
new78.18 KB

I 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.

clairem’s picture

The 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.

#edit-site_name,
#edit-site_mail,
#edit-site_slogan {width: 40em; }

I'm not sure whether width: 90% would work, but you could try it.

nedjo’s picture

Of 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 width overrides would make all elements the same, meaning we couldn't choose short fields. The max-width CSS 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-width and leave it at that.

ricabrantes’s picture

Version: » 7.x-dev

This issue is active??

jody lynn’s picture

Status: Active » Closed (won't fix)

Yes, I think you should use max-width and leave it at that.