diff --git a/modules/product_reference/commerce_product_reference.module b/modules/product_reference/commerce_product_reference.module index 62cb8b8..1f6c65b 100644 --- a/modules/product_reference/commerce_product_reference.module +++ b/modules/product_reference/commerce_product_reference.module @@ -305,7 +305,9 @@ function commerce_product_reference_entity_view($entity, $entity_type, $view_mod $wrapper = NULL; $instances = field_info_instances($entity_type, $bundle); - $reference_view_mode = $entity_type . '_' . $view_mode; + $view_mode_settings = field_view_mode_settings($entity_type, $bundle); + $reference_view_mode = (!empty($view_mode_settings[$entity_type . '_' . $view_mode]['custom_settings'])) + ? $entity_type . '_' . $view_mode : 'default'; // Loop through product reference fields to see if any exist on this entity // bundle that is either hidden or displayed with the Add to Cart form display @@ -349,9 +351,6 @@ function commerce_product_reference_entity_view($entity, $entity_type, $view_mod // Loop through the fields on the referenced product's type. foreach (field_info_instances('commerce_product', $product->type) as $product_field_name => $product_field) { - if (!isset($product_field['display'][$reference_view_mode])) { - $reference_view_mode = 'default'; - } // Only prepare visible fields. if (!isset($product_field['display'][$reference_view_mode]['type']) || $product_field['display'][$reference_view_mode]['type'] != 'hidden') { @@ -994,7 +993,7 @@ function commerce_product_reference_module_implements_alter(&$implementations, $ /** * Implements hook_entity_info_alter(). * - * Adds the line item and the product display-specific views mode to the product. + * Adds the line item and the product display-specific view modes to the product. */ function commerce_product_reference_entity_info_alter(&$entity_info) { $entity_info['commerce_product']['view modes']['line_item'] = array(