Index: modules/field_ui/field_ui.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/field_ui/field_ui.admin.inc,v
retrieving revision 1.87
diff -u -p -r1.87 field_ui.admin.inc
--- modules/field_ui/field_ui.admin.inc 30 Nov 2010 23:55:11 -0000 1.87
+++ modules/field_ui/field_ui.admin.inc 3 Dec 2010 13:59:31 -0000
@@ -772,7 +772,12 @@ function field_ui_field_overview_form_su
field_create_field($field);
field_create_instance($instance);
- $destinations[] = $admin_path . '/fields/' . $field['field_name'] . '/field-settings';
+ // Only show field settings form if there actually are any settings to
+ // configure.
+ $field_info = field_info_field($field['field_name']);
+ if (!empty($field_info['settings'])) {
+ $destinations[] = $admin_path . '/fields/' . $field['field_name'] . '/field-settings';
+ }
$destinations[] = $admin_path . '/fields/' . $field['field_name'];
// Store new field information for any additional submit handlers.
@@ -804,7 +809,7 @@ function field_ui_field_overview_form_su
try {
field_create_instance($instance);
- $destinations[] = $admin_path . '/fields/' . $instance['field_name'] . '/edit';
+ $destinations[] = $admin_path . '/fields/' . $instance['field_name'];
// Store new field information for any additional submit handlers.
$form_state['fields_added']['_add_existing_field'] = $instance['field_name'];
}
@@ -1727,8 +1732,12 @@ function field_ui_field_edit_form($form,
$bundle = $instance['bundle'];
$entity_type = $instance['entity_type'];
$field = field_info_field($instance['field_name']);
+ $bundles = field_info_bundles();
- drupal_set_title($instance['label']);
+ drupal_set_title(t('%instance settings for %bundle', array(
+ '%instance' => $instance['label'],
+ '%bundle' => $bundles[$entity_type][$bundle]['label'],
+ )), PASS_THROUGH);
$form['#field'] = $field;
$form['#instance'] = $instance;
@@ -1740,22 +1749,11 @@ function field_ui_field_edit_form($form,
return $form;
}
- $field_type = field_info_field_types($field['type']);
$widget_type = field_info_widget_types($instance['widget']['type']);
- $bundles = field_info_bundles();
// Create a form structure for the instance values.
$form['instance'] = array(
'#tree' => TRUE,
- '#type' => 'fieldset',
- '#title' => t('%type settings', array('%type' => $bundles[$entity_type][$bundle]['label'])),
- '#description' => t('These settings apply only to the %field field when used in the %type type.', array(
- '%field' => $instance['label'],
- '%type' => $bundles[$entity_type][$bundle]['label'],
- )),
- // Ensure field_ui_field_edit_instance_pre_render() gets called in addition
- // to, not instead of, the #pre_render function(s) needed by all fieldsets.
- '#pre_render' => array_merge(array('field_ui_field_edit_instance_pre_render'), element_info_property('fieldset', '#pre_render', array())),
);
// Build the non-configurable instance values.
@@ -1782,13 +1780,11 @@ function field_ui_field_edit_form($form,
'#title' => t('Label'),
'#default_value' => !empty($instance['label']) ? $instance['label'] : $field['field_name'],
'#required' => TRUE,
- '#weight' => -20,
);
$form['instance']['required'] = array(
'#type' => 'checkbox',
'#title' => t('Required field'),
'#default_value' => !empty($instance['required']),
- '#weight' => -10,
);
$form['instance']['description'] = array(
@@ -1797,7 +1793,6 @@ function field_ui_field_edit_form($form,
'#default_value' => !empty($instance['description']) ? $instance['description'] : '',
'#rows' => 5,
'#description' => t('Instructions to present to the user below this field on the editing form.
Allowed HTML tags: @tags', array('@tags' => _field_filter_xss_display_allowed_tags())),
- '#weight' => 0,
);
// Build the widget component of the instance.
@@ -1832,76 +1827,12 @@ function field_ui_field_edit_form($form,
$form['instance']['default_value_widget'] = field_ui_default_value_widget($field, $instance, $form, $form_state);
}
- $has_data = field_has_data($field);
- if ($has_data) {
- $description = '
' . t('These settings apply to the %field field everywhere it is used. Because the field already has data, some settings can no longer be changed.', array('%field' => $instance['label'])) . '
'; - } - else { - $description = '' . t('These settings apply to the %field field everywhere it is used.', array('%field' => $instance['label'])) . '
'; - } - - // Create a form structure for the field values. - $form['field'] = array( - '#type' => 'fieldset', - '#title' => t('%field field settings', array('%field' => $instance['label'])), - '#description' => $description, - '#tree' => TRUE, - ); - - // Build the configurable field values. - $description = t('Maximum number of values users can enter for this field.'); - if (field_behaviors_widget('multiple values', $instance) == FIELD_BEHAVIOR_DEFAULT) { - $description .= '