Commit 5cc6df56 authored by Dries's avatar Dries
Browse files

- Patch #629074 by sun: field widgets are not themeable due to missing CSS...

- Patch #629074 by sun: field widgets are not themeable due to missing CSS class names. Better CSS classes for fields.
parent 3093c22b
......@@ -60,7 +60,7 @@ function field_default_form($obj_type, $object, $field, $instance, $langcode, $i
$element = array(
'#object_type' => $instance['object_type'],
'#bundle' => $instance['bundle'],
'#field_name' => $field['field_name'],
'#field_name' => $field_name,
'#columns' => array_keys($field['columns']),
'#title' => check_plain(t($instance['label'])),
'#description' => field_filter_xss($instance['description']),
......@@ -89,14 +89,23 @@ function field_default_form($obj_type, $object, $field, $instance, $langcode, $i
// The '#language' key can be used to access the field's form element when
// $langcode is unknown. The #weight property is inherited from the field's
// form element.
$addition[$field['field_name']] = array(
// Also aid in theming of field widgets by rendering a classified container.
$addition[$field_name] = array(
'#type' => 'container',
'#attributes' => array(
'class' => array(
'field-type-' . drupal_html_class($field['type']),
'field-name-' . drupal_html_class($field_name),
'field-widget-' . drupal_html_class($instance['widget']['type']),
),
),
'#tree' => TRUE,
'#weight' => $instance['widget']['weight'],
'#language' => $langcode,
$langcode => $form_element,
);
$form['#fields'][$field['field_name']]['form_path'] = array($field['field_name']);
$form['#fields'][$field_name]['form_path'] = array($field_name);
}
return $addition;
......
......@@ -298,9 +298,6 @@ function number_field_widget(&$form, &$form_state, $field, $instance, $langcode,
// configurations where all characters won't fit in input field.
'#size' => $field['type'] == 'number_decimal' ? $field['settings']['precision'] + 2 : 12,
'#maxlength' => $field['type'] == 'number_decimal' ? $field['settings']['precision'] : 10,
// A specific CSS class is needed to override node form's default styling
// which forces the width of textfields.
'#attributes' => array('class' => array('widget-number')),
// Extract the number type from the field type name for easier validation.
'#number_type' => str_replace('number_', '', $field['type']),
);
......
......@@ -617,7 +617,6 @@ function text_textfield_elements_process($element, $form_state, $form) {
'#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : NULL,
'#autocomplete_path' => $element['#autocomplete_path'],
'#size' => $instance['widget']['settings']['size'],
'#attributes' => array('class' => array('text')),
'#title' => $element['#title'],
'#description' => $element['#description'],
'#required' => $element['#required'],
......@@ -706,7 +705,6 @@ function text_textarea_with_summary_process($element, $form_state, $form) {
'#title' => $display ? t('Full text') : $element['#title'],
'#description' => $element['#description'],
'#required' => $element['#required'],
'#attributes' => array('class' => array('text-full-textarea')),
'#prefix' => '<div class="text-full-wrapper">',
'#suffix' => '</div>',
);
......
......@@ -27,12 +27,3 @@ form .field-multiple-table td.field-multiple-drag a.tabledrag-handle {
form .field-add-more-submit {
margin: .5em 0 0;
}
form .form-item .text {
display: inline;
width: auto;
}
form .form-item .widget-number {
display: inline;
width: auto;
}
......@@ -500,7 +500,6 @@ function file_field_widget(&$form, &$form_state, $field, $instance, $langcode, $
$elements['#file_upload_delta'] = $delta;
$elements['#theme'] = 'file_widget_multiple';
$elements['#theme_wrappers'] = array('fieldset');
$elements['#attributes']['class'] = array('file-widget');
$elements['#process'] = array('file_field_widget_process_multiple');
$elements['#title'] = $element['#title'];
$elements['#description'] = $element['#description'];
......
......@@ -24,10 +24,6 @@
td.revision-current {
background: #ffc;
}
.node-form .form-text {
display: block;
width: 95%;
}
.node-form .container-inline .form-text {
display: inline;
width: auto;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment