diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-02-11 17:44:47 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-02-11 17:44:47 +0000 |
commit | 7562a8efb36306e96bf4d13b1f97b4573809ab45 (patch) | |
tree | 998dfd1d27d9c1a691a83a0c0e37d783d4fc4a44 /modules/field_ui | |
parent | 52195a6b1dd478875a93935df27d7bcacb14f289 (diff) | |
download | brdo-7562a8efb36306e96bf4d13b1f97b4573809ab45.tar.gz brdo-7562a8efb36306e96bf4d13b1f97b4573809ab45.tar.bz2 |
#707724 by chx: Rename confusing arguments in field/entity APIs.
Diffstat (limited to 'modules/field_ui')
-rw-r--r-- | modules/field_ui/field_ui.admin.inc | 122 | ||||
-rw-r--r-- | modules/field_ui/field_ui.module | 66 | ||||
-rw-r--r-- | modules/field_ui/field_ui.test | 6 |
3 files changed, 97 insertions, 97 deletions
diff --git a/modules/field_ui/field_ui.admin.inc b/modules/field_ui/field_ui.admin.inc index c02690392..9d4cb4647 100644 --- a/modules/field_ui/field_ui.admin.inc +++ b/modules/field_ui/field_ui.admin.inc @@ -15,14 +15,14 @@ function field_ui_fields_list() { $bundles = field_info_bundles(); $header = array(t('Field name'), t('Field type'), t('Used in')); $rows = array(); - foreach ($instances as $obj_type => $type_bundles) { + foreach ($instances as $entity_type => $type_bundles) { foreach ($type_bundles as $bundle => $bundle_instances) { foreach ($bundle_instances as $field_name => $instance) { $field = field_info_field($field_name); - $admin_path = _field_ui_bundle_admin_path($obj_type, $bundle); + $admin_path = _field_ui_bundle_admin_path($entity_type, $bundle); $rows[$field_name]['data'][0] = $field['locked'] ? t('@field_name (Locked)', array('@field_name' => $field_name)) : $field_name; $rows[$field_name]['data'][1] = t($field_types[$field['type']]['label']); - $rows[$field_name]['data'][2][] = l($bundles[$obj_type][$bundle]['label'], $admin_path . '/fields'); + $rows[$field_name]['data'][2][] = l($bundles[$entity_type][$bundle]['label'], $admin_path . '/fields'); $rows[$field_name]['class'] = $field['locked'] ? array('menu-disabled') : array(''); } } @@ -44,8 +44,8 @@ function field_ui_fields_list() { /** * Helper function to display a message about inactive fields. */ -function field_ui_inactive_message($obj_type, $bundle) { - $inactive_instances = field_ui_inactive_instances($obj_type, $bundle); +function field_ui_inactive_message($entity_type, $bundle) { + $inactive_instances = field_ui_inactive_instances($entity_type, $bundle); if (!empty($inactive_instances)) { $field_types = field_info_field_types(); $widget_types = field_info_widget_types(); @@ -67,11 +67,11 @@ function field_ui_inactive_message($obj_type, $bundle) { * * Allows fields and pseudo-fields to be re-ordered. */ -function field_ui_field_overview_form($form, &$form_state, $obj_type, $bundle) { - $bundle = field_extract_bundle($obj_type, $bundle); +function field_ui_field_overview_form($form, &$form_state, $entity_type, $bundle) { + $bundle = field_extract_bundle($entity_type, $bundle); - field_ui_inactive_message($obj_type, $bundle); - $admin_path = _field_ui_bundle_admin_path($obj_type, $bundle); + field_ui_inactive_message($entity_type, $bundle); + $admin_path = _field_ui_bundle_admin_path($entity_type, $bundle); // When displaying the form, make sure the list of fields is up-to-date. if (empty($form_state['post'])) { @@ -79,18 +79,18 @@ function field_ui_field_overview_form($form, &$form_state, $obj_type, $bundle) { } // Gather bundle information. - $instances = field_info_instances($obj_type, $bundle); + $instances = field_info_instances($entity_type, $bundle); $field_types = field_info_field_types(); $widget_types = field_info_widget_types(); - $extra = field_extra_fields($obj_type, $bundle); + $extra = field_extra_fields($entity_type, $bundle); // Store each default weight so that we can add the 'add new' rows after them. $weights = array(); $form += array( '#tree' => TRUE, - '#object_type' => $obj_type, + '#object_type' => $entity_type, '#bundle' => $bundle, '#fields' => array_keys($instances), '#extra' => array_keys($extra), @@ -238,7 +238,7 @@ function field_ui_field_overview_form($form, &$form_state, $obj_type, $bundle) { } // Additional row: add existing field. - $existing_field_options = field_ui_existing_field_options($obj_type, $bundle); + $existing_field_options = field_ui_existing_field_options($entity_type, $bundle); if ($existing_field_options && $widget_type_options) { $weight++; array_unshift($existing_field_options, t('- Select an existing field -')); @@ -459,15 +459,15 @@ function _field_ui_field_overview_form_validate_add_existing($form, &$form_state */ function field_ui_field_overview_form_submit($form, &$form_state) { $form_values = $form_state['values']; - $obj_type = $form['#object_type']; + $entity_type = $form['#object_type']; $bundle = $form['#bundle']; - $admin_path = _field_ui_bundle_admin_path($obj_type, $bundle); + $admin_path = _field_ui_bundle_admin_path($entity_type, $bundle); // Update field weights. $extra = array(); foreach ($form_values as $key => $values) { if (in_array($key, $form['#fields'])) { - $instance = field_read_instance($obj_type, $key, $bundle); + $instance = field_read_instance($entity_type, $key, $bundle); $instance['widget']['weight'] = $values['weight']; foreach($instance['display'] as $view_mode => $display) { $instance['display'][$view_mode]['weight'] = $values['weight']; @@ -480,7 +480,7 @@ function field_ui_field_overview_form_submit($form, &$form_state) { } $extra_weights = variable_get('field_extra_weights', array()); - $extra_weights[$obj_type][$bundle] = $extra; + $extra_weights[$entity_type][$bundle] = $extra; variable_set('field_extra_weights', $extra_weights); $destinations = array(); @@ -497,7 +497,7 @@ function field_ui_field_overview_form_submit($form, &$form_state) { ); $instance = array( 'field_name' => $field['field_name'], - 'object_type' => $obj_type, + 'object_type' => $entity_type, 'bundle' => $bundle, 'label' => $values['label'], 'widget' => array( @@ -532,7 +532,7 @@ function field_ui_field_overview_form_submit($form, &$form_state) { else { $instance = array( 'field_name' => $field['field_name'], - 'object_type' => $obj_type, + 'object_type' => $entity_type, 'bundle' => $bundle, 'label' => $values['label'], 'widget' => array( @@ -567,20 +567,20 @@ function field_ui_field_overview_form_submit($form, &$form_state) { * This form includes form widgets to select which fields appear in teaser and * full view modes, and how the field labels should be rendered. */ -function field_ui_display_overview_form($form, &$form_state, $obj_type, $bundle, $view_modes_selector = 'basic') { - $bundle = field_extract_bundle($obj_type, $bundle); +function field_ui_display_overview_form($form, &$form_state, $entity_type, $bundle, $view_modes_selector = 'basic') { + $bundle = field_extract_bundle($entity_type, $bundle); - field_ui_inactive_message($obj_type, $bundle); - $admin_path = _field_ui_bundle_admin_path($obj_type, $bundle); + field_ui_inactive_message($entity_type, $bundle); + $admin_path = _field_ui_bundle_admin_path($entity_type, $bundle); // Gather type information. - $instances = field_info_instances($obj_type, $bundle); + $instances = field_info_instances($entity_type, $bundle); $field_types = field_info_field_types(); - $view_modes = field_ui_view_modes_tabs($obj_type, $view_modes_selector); + $view_modes = field_ui_view_modes_tabs($entity_type, $view_modes_selector); $form += array( '#tree' => TRUE, - '#object_type' => $obj_type, + '#object_type' => $entity_type, '#bundle' => $bundle, '#fields' => array_keys($instances), '#contexts' => $view_modes_selector, @@ -777,14 +777,14 @@ function field_ui_formatter_options($field_type = NULL) { /** * Return an array of existing field to be added to a bundle. */ -function field_ui_existing_field_options($obj_type, $bundle) { +function field_ui_existing_field_options($entity_type, $bundle) { $options = array(); $field_types = field_info_field_types(); foreach (field_info_instances() as $existing_obj_type => $bundles) { foreach ($bundles as $existing_bundle => $instances) { // No need to look in the current bundle. - if (!($existing_bundle == $bundle && $existing_obj_type == $obj_type)) { + if (!($existing_bundle == $bundle && $existing_obj_type == $entity_type)) { foreach ($instances as $instance) { $field = field_info_field($instance['field_name']); // Don't show @@ -792,8 +792,8 @@ function field_ui_existing_field_options($obj_type, $bundle) { // - fields already in the current bundle, // - field that cannot be added to the object type. if (empty($field['locked']) - && !field_info_instance($obj_type, $field['field_name'], $bundle) - && (empty($field['object_types']) || in_array($obj_type, $field['object_types']))) { + && !field_info_instance($entity_type, $field['field_name'], $bundle) + && (empty($field['object_types']) || in_array($entity_type, $field['object_types']))) { $text = t('@type: @field (@label)', array( '@type' => $field_types[$field['type']]['label'], '@label' => t($instance['label']), '@field' => $instance['field_name'], @@ -812,9 +812,9 @@ function field_ui_existing_field_options($obj_type, $bundle) { /** * Menu callback; presents the field settings edit page. */ -function field_ui_field_settings_form($form, &$form_state, $obj_type, $bundle, $field) { - $bundle = field_extract_bundle($obj_type, $bundle); - $instance = field_info_instance($obj_type, $field['field_name'], $bundle); +function field_ui_field_settings_form($form, &$form_state, $entity_type, $bundle, $field) { + $bundle = field_extract_bundle($entity_type, $bundle); + $instance = field_info_instance($entity_type, $field['field_name'], $bundle); // When a field is first created, we have to get data from the db. if (!isset($instance['label'])) { @@ -860,7 +860,7 @@ function field_ui_field_settings_form($form, &$form_state, $obj_type, $bundle, $ '#markup' => t('%field has no field settings.', array('%field' => $instance['label'])), ); } - $form['#object_type'] = $obj_type; + $form['#object_type'] = $entity_type; $form['#bundle'] = $bundle; $form['actions'] = array('#type' => 'container', '#attributes' => array('class' => array('form-actions'))); @@ -878,9 +878,9 @@ function field_ui_field_settings_form_submit($form, &$form_state) { // Merge incoming form values into the existing field. $field = field_info_field($field_values['field_name']); - $obj_type = $form['#object_type']; + $entity_type = $form['#object_type']; $bundle = $form['#bundle']; - $instance = field_info_instance($obj_type, $field['field_name'], $bundle); + $instance = field_info_instance($entity_type, $field['field_name'], $bundle); // Update the field. $field = array_merge($field, $field_values); @@ -888,28 +888,28 @@ function field_ui_field_settings_form_submit($form, &$form_state) { try { field_update_field($field); drupal_set_message(t('Updated field %label field settings.', array('%label' => $instance['label']))); - $form_state['redirect'] = field_ui_next_destination($obj_type, $bundle); + $form_state['redirect'] = field_ui_next_destination($entity_type, $bundle); } catch (FieldException $e) { drupal_set_message(t('Attempt to update field %label failed: %message.', array('%label' => $instance['label'], '%message' => $e->getMessage())), 'error'); // TODO: Where do we go from here? - $form_state['redirect'] = field_ui_next_destination($obj_type, $bundle); + $form_state['redirect'] = field_ui_next_destination($entity_type, $bundle); } } /** * Menu callback; select a widget for the field. */ -function field_ui_widget_type_form($form, &$form_state, $obj_type, $bundle, $field) { - $bundle = field_extract_bundle($obj_type, $bundle); - $instance = field_info_instance($obj_type, $field['field_name'], $bundle); +function field_ui_widget_type_form($form, &$form_state, $entity_type, $bundle, $field) { + $bundle = field_extract_bundle($entity_type, $bundle); + $instance = field_info_instance($entity_type, $field['field_name'], $bundle); drupal_set_title($instance['label']); $field_type = field_info_field_types($field['type']); $widget_type = field_info_widget_types($instance['widget']['type']); $bundles = field_info_bundles(); - $bundle_label = $bundles[$obj_type][$bundle]['label']; + $bundle_label = $bundles[$entity_type][$bundle]['label']; $form['basic'] = array( '#type' => 'fieldset', @@ -940,7 +940,7 @@ function field_ui_widget_type_form_submit($form, &$form_state) { $form_values = $form_state['values']; $instance = $form['#instance']; $bundle = $instance['bundle']; - $obj_type = $instance['object_type']; + $entity_type = $instance['object_type']; // Set the right module information. $widget_type = field_info_widget_types($form_values['widget_type']); @@ -956,18 +956,18 @@ function field_ui_widget_type_form_submit($form, &$form_state) { drupal_set_message(t('There was a problem changing the widget for field %label.', array('%label' => $instance['label']))); } - $form_state['redirect'] = field_ui_next_destination($obj_type, $bundle); + $form_state['redirect'] = field_ui_next_destination($entity_type, $bundle); } /** * Menu callback; present a form for removing a field from a content type. */ -function field_ui_field_delete_form($form, &$form_state, $obj_type, $bundle, $field) { - $bundle = field_extract_bundle($obj_type, $bundle); - $instance = field_info_instance($obj_type, $field['field_name'], $bundle); - $admin_path = _field_ui_bundle_admin_path($obj_type, $bundle); +function field_ui_field_delete_form($form, &$form_state, $entity_type, $bundle, $field) { + $bundle = field_extract_bundle($entity_type, $bundle); + $instance = field_info_instance($entity_type, $field['field_name'], $bundle); + $admin_path = _field_ui_bundle_admin_path($entity_type, $bundle); - $form['object_type'] = array('#type' => 'value', '#value' => $obj_type); + $form['object_type'] = array('#type' => 'value', '#value' => $entity_type); $form['bundle'] = array('#type' => 'value', '#value' => $bundle); $form['field_name'] = array('#type' => 'value', '#value' => $field['field_name']); @@ -994,11 +994,11 @@ function field_ui_field_delete_form_submit($form, &$form_state) { $form_values = $form_state['values']; $field_name = $form_values['field_name']; $bundle = $form_values['bundle']; - $obj_type = $form_values['object_type']; + $entity_type = $form_values['object_type']; $field = field_info_field($form_values['field_name']); - $instance = field_info_instance($obj_type, $field_name, $bundle); + $instance = field_info_instance($entity_type, $field_name, $bundle); $bundles = field_info_bundles(); - $bundle_label = $bundles[$obj_type][$bundle]['label']; + $bundle_label = $bundles[$entity_type][$bundle]['label']; if (!empty($bundle) && $field && !$field['locked'] && $form_values['confirm']) { field_delete_instance($instance); @@ -1012,16 +1012,16 @@ function field_ui_field_delete_form_submit($form, &$form_state) { drupal_set_message(t('There was a problem removing the %field from the %type content type.', array('%field' => $instance['label'], '%type' => $bundle_label))); } - $admin_path = _field_ui_bundle_admin_path($obj_type, $bundle); + $admin_path = _field_ui_bundle_admin_path($entity_type, $bundle); $form_state['redirect'] = field_ui_get_destinations(array($admin_path . '/fields')); } /** * Menu callback; presents the field instance edit page. */ -function field_ui_field_edit_form($form, &$form_state, $obj_type, $bundle, $field) { - $bundle = field_extract_bundle($obj_type, $bundle); - $instance = field_info_instance($obj_type, $field['field_name'], $bundle); +function field_ui_field_edit_form($form, &$form_state, $entity_type, $bundle, $field) { + $bundle = field_extract_bundle($entity_type, $bundle); + $instance = field_info_instance($entity_type, $field['field_name'], $bundle); $form['#field'] = $field; @@ -1043,8 +1043,8 @@ function field_ui_field_edit_form($form, &$form_state, $obj_type, $bundle, $fiel $form['instance'] = array( '#tree' => TRUE, '#type' => 'fieldset', - '#title' => t('%type settings', array('%type' => $bundles[$obj_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[$obj_type][$bundle]['label'])), + '#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'])), '#pre_render' => array('field_ui_field_edit_instance_pre_render'), ); @@ -1055,7 +1055,7 @@ function field_ui_field_edit_form($form, &$form_state, $obj_type, $bundle, $fiel ); $form['instance']['object_type'] = array( '#type' => 'value', - '#value' => $obj_type, + '#value' => $entity_type, ); $form['instance']['bundle'] = array( '#type' => 'value', @@ -1296,13 +1296,13 @@ function field_ui_get_destinations($destinations) { /** * Return the next redirect path in a multipage sequence. */ -function field_ui_next_destination($obj_type, $bundle) { +function field_ui_next_destination($entity_type, $bundle) { $destinations = !empty($_REQUEST['destinations']) ? $_REQUEST['destinations'] : array(); if (!empty($destinations)) { unset($_REQUEST['destinations']); return field_ui_get_destinations($destinations); } - $admin_path = _field_ui_bundle_admin_path($obj_type, $bundle); + $admin_path = _field_ui_bundle_admin_path($entity_type, $bundle); return $admin_path . '/fields'; } diff --git a/modules/field_ui/field_ui.module b/modules/field_ui/field_ui.module index 411375388..d9ee659a4 100644 --- a/modules/field_ui/field_ui.module +++ b/modules/field_ui/field_ui.module @@ -48,7 +48,7 @@ function field_ui_menu() { return $items; } // Create tabs for all possible bundles. - foreach (entity_get_info() as $obj_type => $info) { + foreach (entity_get_info() as $entity_type => $info) { if ($info['fieldable']) { foreach ($info['bundles'] as $bundle_name => $bundle_info) { if (isset($bundle_info['admin'])) { @@ -61,38 +61,38 @@ function field_ui_menu() { $items["$path/fields"] = array( 'title' => 'Manage fields', 'page callback' => 'drupal_get_form', - 'page arguments' => array('field_ui_field_overview_form', $obj_type, $bundle_arg), + 'page arguments' => array('field_ui_field_overview_form', $entity_type, $bundle_arg), 'type' => MENU_LOCAL_TASK, 'weight' => 1, 'file' => 'field_ui.admin.inc', ) + $access; $items["$path/fields/%field_ui_menu"] = array( 'page callback' => 'drupal_get_form', - 'page arguments' => array('field_ui_field_edit_form', $obj_type, $bundle_arg, $field_position), + 'page arguments' => array('field_ui_field_edit_form', $entity_type, $bundle_arg, $field_position), 'type' => MENU_LOCAL_TASK, 'file' => 'field_ui.admin.inc', ) + $access; $items["$path/fields/%field_ui_menu/edit"] = array( 'page callback' => 'drupal_get_form', - 'page arguments' => array('field_ui_field_edit_form', $obj_type, $bundle_arg, $field_position), + 'page arguments' => array('field_ui_field_edit_form', $entity_type, $bundle_arg, $field_position), 'type' => MENU_DEFAULT_LOCAL_TASK, 'file' => 'field_ui.admin.inc', ) + $access; $items["$path/fields/%field_ui_menu/field-settings"] = array( 'page callback' => 'drupal_get_form', - 'page arguments' => array('field_ui_field_settings_form', $obj_type, $bundle_arg, $field_position), + 'page arguments' => array('field_ui_field_settings_form', $entity_type, $bundle_arg, $field_position), 'type' => MENU_LOCAL_TASK, 'file' => 'field_ui.admin.inc', ) + $access; $items["$path/fields/%field_ui_menu/widget-type"] = array( 'page callback' => 'drupal_get_form', - 'page arguments' => array('field_ui_widget_type_form', $obj_type, $bundle_arg, $field_position), + 'page arguments' => array('field_ui_widget_type_form', $entity_type, $bundle_arg, $field_position), 'type' => MENU_LOCAL_TASK, 'file' => 'field_ui.admin.inc', ) + $access; $items["$path/fields/%field_ui_menu/delete"] = array( 'page callback' => 'drupal_get_form', - 'page arguments' => array('field_ui_field_delete_form', $obj_type, $bundle_arg, $field_position), + 'page arguments' => array('field_ui_field_delete_form', $entity_type, $bundle_arg, $field_position), 'type' => MENU_LOCAL_TASK, 'file' => 'field_ui.admin.inc', ) + $access; @@ -101,16 +101,16 @@ function field_ui_menu() { $items["$path/display"] = array( 'title' => 'Manage display', 'page callback' => 'drupal_get_form', - 'page arguments' => array('field_ui_display_overview_form', $obj_type, $bundle_arg), + 'page arguments' => array('field_ui_display_overview_form', $entity_type, $bundle_arg), 'type' => MENU_LOCAL_TASK, 'weight' => 2, 'file' => 'field_ui.admin.inc', ) + $access; - $tabs = field_ui_view_modes_tabs($obj_type); + $tabs = field_ui_view_modes_tabs($entity_type); foreach ($tabs as $key => $tab) { $items["$path/display/$key"] = array( 'title' => $tab['title'], - 'page arguments' => array('field_ui_display_overview_form', $obj_type, $bundle_arg, $key), + 'page arguments' => array('field_ui_display_overview_form', $entity_type, $bundle_arg, $key), 'type' => $key == 'basic' ? MENU_DEFAULT_LOCAL_TASK : MENU_LOCAL_TASK, 'weight' => $key == 'basic' ? 0 : 1, 'file' => 'field_ui.admin.inc', @@ -156,32 +156,32 @@ function field_ui_theme() { * * @todo Remove this completely and use vertical tabs? */ -function field_ui_view_modes_tabs($obj_type, $tab_selector = NULL) { +function field_ui_view_modes_tabs($entity_type, $tab_selector = NULL) { $info = &drupal_static(__FUNCTION__); - if (!isset($info[$obj_type])) { - $info[$obj_type] = module_invoke_all('field_ui_view_modes_tabs', $obj_type); + if (!isset($info[$entity_type])) { + $info[$entity_type] = module_invoke_all('field_ui_view_modes_tabs', $entity_type); // Filter out inactive modes. - $entity_info = entity_get_info($obj_type); - foreach ($info[$obj_type] as $tab => $values) { + $entity_info = entity_get_info($entity_type); + foreach ($info[$entity_type] as $tab => $values) { $modes = array(); - foreach ($info[$obj_type][$tab]['view modes'] as $mode) { + foreach ($info[$entity_type][$tab]['view modes'] as $mode) { if (isset($entity_info['view modes'][$mode])) { $modes[] = $mode; } } if ($modes) { - $info[$obj_type][$tab]['view modes'] = $modes; + $info[$entity_type][$tab]['view modes'] = $modes; } else { - unset($info[$obj_type][$tab]); + unset($info[$entity_type][$tab]); } } } if ($tab_selector) { - return isset($info[$obj_type][$tab_selector]) ? $info[$obj_type][$tab_selector]['view modes'] : array(); + return isset($info[$entity_type][$tab_selector]) ? $info[$entity_type][$tab_selector]['view modes'] : array(); } - return $info[$obj_type]; + return $info[$entity_type]; } /** @@ -229,7 +229,7 @@ function field_ui_field_ui_view_modes_tabs() { /** * Implements hook_field_attach_create_bundle(). */ -function field_ui_field_attach_create_bundle($obj_type, $bundle) { +function field_ui_field_attach_create_bundle($entity_type, $bundle) { // When a new bundle is created, the menu needs to be rebuilt to add our // menu item tabs. variable_set('menu_rebuild_needed', TRUE); @@ -238,12 +238,12 @@ function field_ui_field_attach_create_bundle($obj_type, $bundle) { /** * Implements hook_field_attach_rename_bundle(). */ -function field_ui_field_attach_rename_bundle($obj_type, $bundle_old, $bundle_new) { +function field_ui_field_attach_rename_bundle($entity_type, $bundle_old, $bundle_new) { if ($bundle_old !== $bundle_new) { $extra_weights = variable_get('field_extra_weights', array()); - if (isset($info[$obj_type][$bundle_old])) { - $extra_weights[$obj_type][$bundle_new] = $extra_weights[$obj_type][$bundle_old]; - unset($extra_weights[$obj_type][$bundle_old]); + if (isset($info[$entity_type][$bundle_old])) { + $extra_weights[$entity_type][$bundle_new] = $extra_weights[$entity_type][$bundle_old]; + unset($extra_weights[$entity_type][$bundle_old]); variable_set('field_extra_weights', $extra_weights); } } @@ -252,10 +252,10 @@ function field_ui_field_attach_rename_bundle($obj_type, $bundle_old, $bundle_new /** * Implements hook_field_attach_delete_bundle(). */ -function field_ui_field_attach_delete_bundle($obj_type, $bundle) { +function field_ui_field_attach_delete_bundle($entity_type, $bundle) { $extra_weights = variable_get('field_extra_weights', array()); - if (isset($extra_weights[$obj_type][$bundle])) { - unset($extra_weights[$obj_type][$bundle]); + if (isset($extra_weights[$entity_type][$bundle])) { + unset($extra_weights[$entity_type][$bundle]); variable_set('field_extra_weights', $extra_weights); } } @@ -263,8 +263,8 @@ function field_ui_field_attach_delete_bundle($obj_type, $bundle) { /** * Helper function to create the right administration path for a bundle. */ -function _field_ui_bundle_admin_path($obj_type, $bundle_name) { - $bundles = field_info_bundles($obj_type); +function _field_ui_bundle_admin_path($entity_type, $bundle_name) { + $bundles = field_info_bundles($entity_type); $bundle_info = $bundles[$bundle_name]; return isset($bundle_info['admin']['real path']) ? $bundle_info['admin']['real path'] : $bundle_info['admin']['path']; } @@ -272,7 +272,7 @@ function _field_ui_bundle_admin_path($obj_type, $bundle_name) { /** * Helper function to identify inactive fields within a bundle. */ -function field_ui_inactive_instances($obj_type, $bundle_name = NULL) { +function field_ui_inactive_instances($entity_type, $bundle_name = NULL) { if (!empty($bundle_name)) { $inactive = array($bundle_name => array()); $params = array('bundle' => $bundle_name); @@ -281,9 +281,9 @@ function field_ui_inactive_instances($obj_type, $bundle_name = NULL) { $inactive = array(); $params = array(); } - $params['object_type'] = $obj_type; + $params['object_type'] = $entity_type; - $active_instances = field_info_instances($obj_type); + $active_instances = field_info_instances($entity_type); $all_instances = field_read_instances($params, array('include_inactive' => TRUE)); foreach ($all_instances as $instance) { if (!isset($active_instances[$instance['bundle']][$instance['field_name']])) { diff --git a/modules/field_ui/field_ui.test b/modules/field_ui/field_ui.test index e3f030782..624ddd3e5 100644 --- a/modules/field_ui/field_ui.test +++ b/modules/field_ui/field_ui.test @@ -205,10 +205,10 @@ class FieldUITestCase extends DrupalWebTestCase { * The field name for the instance. * @param $string * The settings text. - * @param $obj_type + * @param $entity_type * The object type for the instance. */ - function assertFieldSettings($bundle, $field_name, $string = 'dummy test string', $obj_type = 'node') { + function assertFieldSettings($bundle, $field_name, $string = 'dummy test string', $entity_type = 'node') { // Reset the fields info. _field_info_collate_fields(TRUE); // Assert field settings. @@ -216,7 +216,7 @@ class FieldUITestCase extends DrupalWebTestCase { $this->assertTrue($field['settings']['test_field_setting'] == $string, t('Field settings were found.')); // Assert instance and widget settings. - $instance = field_info_instance($obj_type, $field_name, $bundle); + $instance = field_info_instance($entity_type, $field_name, $bundle); $this->assertTrue($instance['settings']['test_instance_setting'] == $string, t('Field instance settings were found.')); $this->assertTrue($instance['widget']['settings']['test_widget_setting'] == $string, t('Field widget settings were found.')); } |