As identified and discussed in #628188: Remove #process pattern from taxo autocomplete widget, only individual form elements inside of field widgets use class names currently.

That, however, is not sufficient for themers, because we want to style the entire widget, either per field type, per field name, or per field widget.

Given those proper wrapping classes for the entire widget, I see no need for individual CSS classes on the contained form elements.

Additionally, the reasoning for the individual CSS classes on the form elements was that node.css applies some wonky width via CSS to ALL textfields in a node form, thereby overriding any text field size/width the user entered in the field configuration (the CSS width always has precedence over the HTML "size" attribute).

Anyway - since all textfields in the node form are fields now, we can remove this wonky CSS style from node.css.

Also note that the required change to theme_container() is also contained in #414424: Introduce Form API #type 'text_format', so this is required for at least two issues in the meantime.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Note that further clean-ups to the resulting HTML markup due to this patch should be done in follow-up issues.

We have to get the fundamental markup change in first, then we can see which widgets can be streamlined and optimized regarding it's markup, stylesheet, and very potentially also JavaScript.

sun’s picture

Issue tags: +D7 API clean-up, +D7 UX freeze

.

yched’s picture

Status: Needs review » Needs work

Agreed on the approach, however:

- "since all textfields in the node form are fields now"
well, not textfields within the vertical tabs at the bottom (URL alias, author info), and not potential contrib non-field additions. We can't expect all contrib nodeapi additions to become fields in D7

- The classes need to have the '_' => '-' translation:

+      '#attributes' => array('class' => array(
+        'field-type-' . $field['type'],
+        'field-name-' . $field_name,
+        'field-widget-' . $instance['widget']['type'],
+      )),
sun’s picture

Status: Needs work » Needs review

1) Correct. But form elements not being fields added by contributed modules will most likely have their own CSS class and own stylesheet anyway. At least it would be horribly wrong to base the styling on node's global abuse of CSS. ;)

2) Somehow, I fear that this is a bug in the current drupal_attributes(). Class names as well as HTML IDs (which also don't work) should be sanitized before building the joined HTML attribute string. At least, that was the purpose. ;) So I think that's a separate bug.

sun’s picture

oh, and on the further text fields in the vertical tabs: I double-checked those, and they are working + looking still correct, and I'd even say that it's better for UX to have textfields in a size that maps to the expected value/content...

i.e. for which node author username do I need a textfield in a width of 600px? ;)

And lastly, that's a job for a theme, not a module.

sun’s picture

uhm. Seems I was mistaken. I somehow thought that #464862: Add drupal_css_class() to clean class names and rename form_clean_id would have automated drupal_html_id/class() invocations. :-/

So here's a proper patch.

yched’s picture

Status: Needs review » Needs work

Agreed on the last 3 posts :-)

Last nitpick: if we remove the 'widget-number' and 'text' classes in number.module and text.module, then we should also remove the corresponding lines in field.css

sun’s picture

Status: Needs work » Needs review
FileSize
7.09 KB

Agreed.

yched’s picture

Status: Needs review » Reviewed & tested by the community

Sweet :-)

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)
Issue tags: -markup, -Needs themer review, -D7 API clean-up, -D7 UX freeze

Automatically closed -- issue fixed for 2 weeks with no activity.