I've several product reference fields, but now way to distinguish them in the Views UI (besides checking the HTML).

Would be nice to see a list with the entities using the field and which product types can be referenced with it.
Attached patch adds these information to the help text.
Since I don't know why hook_field_views_data_alter() instead hook_field_views_data() is used I created two patches. One stays with hook_field_views_data_alter(), the other switches to hook_field_views_data().

Comments

pcambra’s picture

rszrama’s picture

Status: Needs review » Fixed
Issue tags: +dcsprint5

w00t! Committed with a minor change - we don't want to split out part of the help text into a separate t() string, because it will be harder for translators (especially for languages with different word order). Instead I calculate the help message where you were currently checking if the $referenceable_types array was empty.

rfay’s picture

Status: Fixed » Needs work

Get these errors today after this commit; das-peter says probably due to this patch.

When visiting admin/commerce/products, I see:

    * Notice: Undefined index: referenceable_types in commerce_product_reference_field_views_data_alter() (line 913 of /home/rfay/workspace/commerce/sites/all/modules/drupalcommerce/modules/product_reference/commerce_product_reference.module).
    * Warning: array_filter() [function.array-filter]: The first argument should be an array in commerce_product_reference_field_views_data_alter() (line 913 of /home/rfay/workspace/commerce/sites/all/modules/drupalcommerce/modules/product_reference/commerce_product_reference.module).
    * Warning: implode() [function.implode]: Invalid arguments passed in commerce_product_reference_field_views_data_alter() (line 914 of /home/rfay/workspace/commerce/sites/all/modules/drupalcommerce/modules/product_reference/commerce_product_reference.module).
    * Notice: Undefined index: referenceable_types in commerce_product_reference_field_views_data_alter() (line 913 of /home/rfay/workspace/commerce/sites/all/modules/drupalcommerce/modules/product_reference/commerce_product_reference.module).
    * Warning: array_filter() [function.array-filter]: The first argument should be an array in commerce_product_reference_field_views_data_alter() (line 913 of /home/rfay/workspace/commerce/sites/all/modules/drupalcommerce/modules/product_reference/commerce_product_reference.module).
    * Warning: implode() [function.implode]: Invalid arguments passed in commerce_product_reference_field_views_data_alter() (line 914 of /home/rfay/workspace/commerce/sites/all/modules/drupalcommerce/modules/product_reference/commerce_product_reference.module).
pcambra’s picture

Can I have more details on this? I don't see how to reproduce it.

rszrama’s picture

Status: Needs work » Fixed

Just figured it out. We had committed a patch earlier this week to provide more information in the description of product reference based relationships, but then we later committed a patch that moved referenceable types for product reference fields to instance settings instead of field settings. I had to revert a little of the information from the first patch to accommodate the change. Tested / committed.

Status: Fixed » Closed (fixed)
Issue tags: -dcsprint5

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