From e5f48f0f780ac0ea08ecbf31c85f9bcdc80147ac Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sat, 30 Jan 2010 02:22:01 +0000 Subject: #680910 by yched and bjaspan: Allow fields to be restricted to entity types. --- modules/field_ui/field_ui.admin.inc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'modules/field_ui/field_ui.admin.inc') diff --git a/modules/field_ui/field_ui.admin.inc b/modules/field_ui/field_ui.admin.inc index eb94ed6c7..4104e04cf 100644 --- a/modules/field_ui/field_ui.admin.inc +++ b/modules/field_ui/field_ui.admin.inc @@ -787,8 +787,13 @@ function field_ui_existing_field_options($obj_type, $bundle) { if (!($existing_bundle == $bundle && $existing_obj_type == $obj_type)) { foreach ($instances as $instance) { $field = field_info_field($instance['field_name']); - // Don't show locked fields or fields already in the current bundle. - if (empty($field['locked']) && !field_info_instance($obj_type, $field['field_name'], $bundle)) { + // Don't show + // - locked fields, + // - 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']))) { $text = t('@type: @field (@label)', array( '@type' => $field_types[$field['type']]['label'], '@label' => t($instance['label']), '@field' => $instance['field_name'], -- cgit v1.2.3