From 8035c50ef229fe405354595fa6ea3dd06d3503f3 Mon Sep 17 00:00:00 2001 From: Dries <dries@buytaert.net> Date: Mon, 9 Jul 2012 16:32:54 -0400 Subject: [PATCH] - Patch #1430670 by ELC, izus: Manage fields - Rename 'Add existing field' to 'Re-use existing field'. --- core/modules/field_ui/field_ui.admin.inc | 18 +++++++++--------- core/modules/field_ui/field_ui.module | 2 +- .../Drupal/field_ui/Tests/FieldUiTestBase.php | 2 +- .../Drupal/field_ui/Tests/ManageFieldsTest.php | 14 +++++++------- core/modules/taxonomy/taxonomy.module | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/core/modules/field_ui/field_ui.admin.inc b/core/modules/field_ui/field_ui.admin.inc index 9689bb31cc7f..5871be081643 100644 --- a/core/modules/field_ui/field_ui.admin.inc +++ b/core/modules/field_ui/field_ui.admin.inc @@ -556,7 +556,7 @@ function field_ui_field_overview_form($form, &$form_state, $entity_type, $bundle ); } - // Additional row: add existing field. + // Additional row: re-use existing field. $existing_fields = field_ui_existing_field_options($entity_type, $bundle); if ($existing_fields && $widget_type_options) { // Build list of options. @@ -582,7 +582,7 @@ function field_ui_field_overview_form($form, &$form_state, $entity_type, $bundle '#size' => 15, '#description' => t('Label'), '#attributes' => array('class' => array('label-textfield')), - '#prefix' => '<div class="label-input"><div class="add-new-placeholder">' . t('Add existing field') .'</div>', + '#prefix' => '<div class="label-input"><div class="add-new-placeholder">' . t('Re-use existing field') .'</div>', '#suffix' => '</div>', ), 'weight' => array( @@ -737,7 +737,7 @@ function _field_ui_field_name_exists($value) { } /** - * Validates the 'add existing field' row of field_ui_field_overview_form(). + * Validates the 're-use existing field' row of field_ui_field_overview_form(). * * @see field_ui_field_overview_form_validate() */ @@ -747,27 +747,27 @@ function _field_ui_field_overview_form_validate_add_existing($form, &$form_state if (isset($form_state['values']['fields']['_add_existing_field'])) { $field = $form_state['values']['fields']['_add_existing_field']; - // Validate if any information was provided in the 'add existing field' row. + // Validate if any information was provided in the 're-use existing field' row. if (array_filter(array($field['label'], $field['field_name'], $field['widget_type']))) { // Missing label. if (!$field['label']) { - form_set_error('fields][_add_existing_field][label', t('Add existing field: you need to provide a label.')); + form_set_error('fields][_add_existing_field][label', t('Re-use existing field: you need to provide a label.')); } // Missing existing field name. if (!$field['field_name']) { - form_set_error('fields][_add_existing_field][field_name', t('Add existing field: you need to select a field.')); + form_set_error('fields][_add_existing_field][field_name', t('Re-use existing field: you need to select a field.')); } // Missing widget type. if (!$field['widget_type']) { - form_set_error('fields][_add_existing_field][widget_type', t('Add existing field: you need to select a widget.')); + form_set_error('fields][_add_existing_field][widget_type', t('Re-use existing field: you need to select a widget.')); } // Wrong widget type. elseif ($field['field_name'] && ($existing_field = field_info_field($field['field_name']))) { $widget_types = field_ui_widget_type_options($existing_field['type']); if (!isset($widget_types[$field['widget_type']])) { - form_set_error('fields][_add_existing_field][widget_type', t('Add existing field: invalid widget.')); + form_set_error('fields][_add_existing_field][widget_type', t('Re-use existing field: invalid widget.')); } } } @@ -840,7 +840,7 @@ function field_ui_field_overview_form_submit($form, &$form_state) { } } - // Add existing field. + // Re-use existing field. if (!empty($form_values['_add_existing_field']['field_name'])) { $values = $form_values['_add_existing_field']; $field = field_info_field($values['field_name']); diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module index b65cd3c5cf73..076cc233f983 100644 --- a/core/modules/field_ui/field_ui.module +++ b/core/modules/field_ui/field_ui.module @@ -27,7 +27,7 @@ function field_ui_help($path, $arg) { $output .= '<dd>' . t('You can store one value, a specific maximum number of values, or an unlimited number of values in each field. For example, an employee identification number field might store a single number, whereas a phone number field might store multiple phone numbers. This setting can be changed after you have created the field, but if you reduce the maximum number of values, you may lose information.') . '</dd>'; $output .= '</dl>'; $output .= '<dt>' . t('Reusing fields') . '</dt>'; - $output .= '<dd>' . t('Once you have defined a field, you can reuse it. For example, if you define a custom image field for one content type, and you need to have an image field with the same parameters on another content type, you can add the same field to the second content type, in the <em>Add existing field</em> area of the user interface. You could also add this field to a taxonomy vocabulary, comments, user accounts, etc.') . '</dd>'; + $output .= '<dd>' . t('Once you have defined a field, you can reuse it. For example, if you define a custom image field for one content type, and you need to have an image field with the same parameters on another content type, you can add the same field to the second content type, in the <em>Re-use existing field</em> area of the user interface. You could also add this field to a taxonomy vocabulary, comments, user accounts, etc.') . '</dd>'; $output .= '<dd>' . t('Some settings of a reused field are unique to each use of the field; others are shared across all places you use the field. For example, the label of a text field is unique to each use, while the setting for the number of values is shared.') . '</dd>'; $output .= '<dd>' . t('There are two main reasons for reusing fields. First, reusing fields can save you time over defining new fields. Second, reusing fields also allows you to display, filter, group, and sort content together by field across content types. For example, the contributed Views module allows you to create lists and tables of content. So if you use the same field on multiple content types, you can create a View containing all of those content types together displaying that field, sorted by that field, and/or filtered by that field.') . '</dd>'; $output .= '<dt>' . t('Fields on content items') . '</dt>'; diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Tests/FieldUiTestBase.php b/core/modules/field_ui/lib/Drupal/field_ui/Tests/FieldUiTestBase.php index cc0f45df6d34..08ccd4a8fde2 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/FieldUiTestBase.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/FieldUiTestBase.php @@ -99,7 +99,7 @@ function fieldUIAddExistingField($bundle_path, $initial_edit, $instance_edit = a $label = $initial_edit['fields[_add_existing_field][label]']; $field_name = $initial_edit['fields[_add_existing_field][field_name]']; - // First step : 'Add existing field' on the 'Manage fields' page. + // First step : 'Re-use existing field' on the 'Manage fields' page. $this->drupalPost("$bundle_path/fields", $initial_edit, t('Save')); // Second step : 'Instance settings' form. diff --git a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php index af40230c38a5..4aa0dd621fac 100644 --- a/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php +++ b/core/modules/field_ui/lib/Drupal/field_ui/Tests/ManageFieldsTest.php @@ -85,9 +85,9 @@ function manageFieldsPage() { $this->assertRaw($table_header . '</th>', t('%table_header table header was found.', array('%table_header' => $table_header))); } - // "Add new field" and "Add existing field" aren't a table heading so just + // "Add new field" and "Re-use existing field" aren't a table heading so just // test the text. - foreach (array('Add new field', 'Add existing field') as $element) { + foreach (array('Add new field', 'Re-use existing field') as $element) { $this->assertText($element, t('"@element" was found.', array('@element' => $element))); } } @@ -106,7 +106,7 @@ function createField() { ); $this->fieldUIAddNewField('admin/structure/types/manage/' . $this->type, $edit); - // Assert the field appears in the "add existing field" section for + // Assert the field appears in the "re-use existing field" section for // different entity types; e.g. if a field was added in a node entity, it // should also appear in the 'taxonomy term' entity. $vocabulary = taxonomy_vocabulary_load(1); @@ -141,9 +141,9 @@ function updateField() { * Tests adding an existing field in another content type. */ function addExistingField() { - // Check "Add existing field" appears. + // Check "Re-use existing field" appears. $this->drupalGet('admin/structure/types/manage/page/fields'); - $this->assertRaw(t('Add existing field'), t('"Add existing field" was found.')); + $this->assertRaw(t('Re-use existing field'), t('"Re-use existing field" was found.')); // Check that the list of options respects entity type restrictions on // fields. The 'comment' field is restricted to the 'comment' entity type @@ -307,11 +307,11 @@ function testHiddenFields() { $this->drupalGet($bundle_path); $this->assertFieldByXPath('//table[@id="field-overview"]//td[1]', $instance['label'], t('Field was created and appears in the overview page.')); - // Check that the instance does not appear in the 'add existing field' row + // Check that the instance does not appear in the 're-use existing field' row // on other bundles. $bundle_path = 'admin/structure/types/manage/article/fields/'; $this->drupalGet($bundle_path); - $this->assertFalse($this->xpath('//select[@id="edit-add-existing-field-field-name"]//option[@value=:field_name]', array(':field_name' => $field_name)), t("The 'add existing field' select respects field types 'no_ui' property.")); + $this->assertFalse($this->xpath('//select[@id="edit-add-existing-field-field-name"]//option[@value=:field_name]', array(':field_name' => $field_name)), t("The 're-use existing field' select respects field types 'no_ui' property.")); } /** diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 6697a0aee91f..ddc84fe576c1 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -55,7 +55,7 @@ function taxonomy_help($path, $arg) { $output .= t('You can assign a sub-term to multiple parent terms. For example, <em>fusion</em> can be assigned to both <em>rock</em> and <em>jazz</em>.') . '</dd>'; $output .= '<dd>' . t('Terms in a <em>free-tagging vocabulary</em> can be built gradually as you create or edit content. This is often done used for blogs or photo management applications.') . '</dd>'; $output .= '<dt>' . t('Assigning vocabularies to content types') . '</dt>'; - $output .= '<dd>' . t('Before you can use a new vocabulary to classify your content, a new Taxonomy term field must be added to a <a href="@ctedit">content type</a> on its <em>manage fields</em> page. When adding a taxonomy field, you choose a <em>widget</em> to use to enter the taxonomy information on the content editing page: a select list, checkboxes, radio buttons, or an auto-complete field (to build a free-tagging vocabulary). After choosing the field type and widget, on the subsequent <em>field settings</em> page you can choose the desired vocabulary, whether one or multiple terms can be chosen from the vocabulary, and other settings. The same vocabulary can be added to multiple content types, by using the "Add existing field" section on the manage fields page.', array('@ctedit' => url('admin/structure/types'))) . '</dd>'; + $output .= '<dd>' . t('Before you can use a new vocabulary to classify your content, a new Taxonomy term field must be added to a <a href="@ctedit">content type</a> on its <em>manage fields</em> page. When adding a taxonomy field, you choose a <em>widget</em> to use to enter the taxonomy information on the content editing page: a select list, checkboxes, radio buttons, or an auto-complete field (to build a free-tagging vocabulary). After choosing the field type and widget, on the subsequent <em>field settings</em> page you can choose the desired vocabulary, whether one or multiple terms can be chosen from the vocabulary, and other settings. The same vocabulary can be added to multiple content types, by using the "Re-use existing field" section on the manage fields page.', array('@ctedit' => url('admin/structure/types'))) . '</dd>'; $output .= '<dt>' . t('Classifying content') . '</dt>'; $output .= '<dd>' . t('After the vocabulary is assigned to the content type, you can start classifying content. The field with terms will appear on the content editing screen when you edit or <a href="@addnode">add new content</a>.', array('@addnode' => url('node/add'))) . '</dd>'; $output .= '<dt>' . t('Viewing listings and RSS feeds by term') . '</dt>'; -- GitLab