When you rely on the display_context array that is filled in commerce_product_reference_entity_view, it could be useful to also have the view_mode and/or the langcode of the entity being displayed.
Currently, you only have the entity_type + the entity

Files: 
CommentFileSizeAuthor
#2 commerce-add-view-mode-product-reference-1787728-2.patch674 bytesjsacksick
PASSED: [[SimpleTest]]: [MySQL] 3,589 pass(es).
[ View ]
#1 commerce-add-view-mode-product-reference-1787728-1.patch664 bytesjsacksick
PASSED: [[SimpleTest]]: [MySQL] 3,589 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new664 bytes
PASSED: [[SimpleTest]]: [MySQL] 3,589 pass(es).
[ View ]

Patch attached

StatusFileSize
new674 bytes
PASSED: [[SimpleTest]]: [MySQL] 3,589 pass(es).
[ View ]

Status:Needs review» Fixed

Yep, this is a great feature. Thanks, Jonathan!

On review, I made two quick changes:

  1. I used $reference_view_mode instead of $view_mode, because what's important for rendering product fields is the name of the view mode on the product type itself. The $view_mode variable is the name of the view mode of the entity the product field is getting injected into.
  2. I used 'language' instead of 'langcode' as that's the key used for the $context array in hook_field_attach_view_alter() that makes it through to the product during the cart attributes refresh.

Commit: http://drupalcode.org/project/commerce.git/commitdiff/0ec3b5d

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.