Index: modules/field/modules/list/tests/list.test =================================================================== RCS file: /cvs/drupal/drupal/modules/field/modules/list/tests/list.test,v retrieving revision 1.10 diff -u -p -r1.10 list.test --- modules/field/modules/list/tests/list.test 1 Dec 2010 07:11:38 -0000 1.10 +++ modules/field/modules/list/tests/list.test 8 Dec 2010 10:21:15 -0000 @@ -138,21 +138,21 @@ class ListFieldUITestCase extends FieldT $admin_path = $this->createListFieldAndEdit('list'); // Check that non-integer keys are rejected. $edit = array($element_name => "1.1|one\n"); - $this->drupalPost($admin_path, $edit, t('Save settings')); + $this->drupalPost($admin_path, $edit, t('Save field settings')); $this->assertText("keys must be integers", t('Form validation failed.')); // Test 'List (number)' field type. $admin_path = $this->createListFieldAndEdit('list_number'); // Check that non-numeric keys are rejected. $edit = array($element_name => "1|one\nB|two"); - $this->drupalPost($admin_path, $edit, t('Save settings')); + $this->drupalPost($admin_path, $edit, t('Save field settings')); $this->assertText("each key must be a valid integer or decimal", t('Form validation failed.')); // Test 'List (text)' field type. $admin_path = $this->createListFieldAndEdit('list_text'); // Check that overly long keys are rejected. $edit = array($element_name => "1|one\n" . $this->randomName(256) . "|two"); - $this->drupalPost($admin_path, $edit, t('Save settings')); + $this->drupalPost($admin_path, $edit, t('Save field settings')); $this->assertText("each key must be a string at most 255 characters long", t('Form validation failed.')); // Test 'Boolean' field type. @@ -164,8 +164,8 @@ class ListFieldUITestCase extends FieldT 'on' => $on, 'off' => $off, ); - $this->drupalPost($admin_path, $edit, t('Save settings')); - $this->assertText("Saved test_list_boolean configuration.", t("The 'On' and 'Off' form fields work for boolean fields.")); + $this->drupalPost($admin_path, $edit, t('Save field settings')); + $this->assertRaw(t('Updated field %label field settings.', array('%label' => 'test_list_boolean')), t("The 'On' and 'Off' form fields work for boolean fields.")); // Test the allowed_values on the field settings form. $this->drupalGet($admin_path); $this->assertFieldByName('on', $on, t("The 'On' value is stored correctly.")); @@ -198,7 +198,7 @@ class ListFieldUITestCase extends FieldT ); field_create_instance($instance); - $admin_path = 'admin/structure/types/manage/' . $this->hyphen_type . '/fields/' . $field_name; + $admin_path = 'admin/structure/types/manage/' . $this->hyphen_type . '/fields/' . $field_name . '/field-settings'; return $admin_path; } Index: modules/field/modules/text/text.test =================================================================== RCS file: /cvs/drupal/drupal/modules/field/modules/text/text.test,v retrieving revision 1.32 diff -u -p -r1.32 text.test --- modules/field/modules/text/text.test 25 Oct 2010 15:51:21 -0000 1.32 +++ modules/field/modules/text/text.test 8 Dec 2010 09:58:06 -0000 @@ -470,7 +470,7 @@ class TextTranslationTestCase extends Dr function testTextFieldFormatted() { // Make node body multiple. $edit = array('field[cardinality]' => -1); - $this->drupalPost('admin/structure/types/manage/article/fields/body', $edit, t('Save settings')); + $this->drupalPost('admin/structure/types/manage/article/fields/body/field-settings', $edit, t('Save field settings')); $this->drupalGet('node/add/article'); $this->assertFieldByXPath("//input[@name='body_add_more']", t('Add another item'), t('Body field cardinality set to multiple.')); 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 8 Dec 2010 10:26:52 -0000 @@ -772,6 +772,8 @@ function field_ui_field_overview_form_su field_create_field($field); field_create_instance($instance); + // Always show the field settings step, as the cardinality needs to be + // configured for new fields. $destinations[] = $admin_path . '/fields/' . $field['field_name'] . '/field-settings'; $destinations[] = $admin_path . '/fields/' . $field['field_name']; @@ -804,7 +806,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']; } @@ -1528,6 +1530,20 @@ function field_ui_field_settings_form($f $form['field']['#description'] = '
' . $form['field']['#description']; } + // Build the configurable field values. + $form['field']['cardinality'] = array( + '#type' => 'select', + '#title' => t('Maximum number of values users can enter'), + '#options' => drupal_map_assoc(range(1, 10)) + array(FIELD_CARDINALITY_UNLIMITED => t('Unlimited')), + '#default_value' => $field['cardinality'], + ); + if (field_behaviors_widget('multiple values', $instance) == FIELD_BEHAVIOR_DEFAULT) { + $form['field']['cardinality']['#description'] = t('%unlimited will provide an %add-more button so users can add as many values as they like.', array( + '%unlimited' => t('Unlimited'), + '%add-more' => t('Add another item'), + )); + } + // Build the non-configurable field values. $form['field']['field_name'] = array('#type' => 'value', '#value' => $field['field_name']); $form['field']['type'] = array('#type' => 'value', '#value' => $field['type']); @@ -1727,8 +1743,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 +1760,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 +1791,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 +1804,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.' . 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 .= '