- Issue created by @Giuseppe87
- Merge request !26fix: entityreference_filter_views_data_alter consider entityreference field on commerce entities → (Open) created by Giuseppe87
The module doesn't work with entity reference field on commerce entities.
Add a entity reference field, for example a taxonomy term reference on a Commerce Product type.
Create a view of commerce products.
Try to add a entityreference filter on that field.
The reason is that inside entityreference_filter_views_data_alter
the check for commerce entities is nested:
elseif (mb_strpos($table_name, 'commerce_product') !== FALSE) {
// Commerce product variations.
if ($field_name === 'variation_id' || (mb_substr($field_name, -10) === '_target_id' && $field_info['filter']['field_name'] === 'variations')) {
$target_entity_type = 'commerce_product_variation';
}
// Commerce product.
if ($field_name === 'product_id') {
$target_entity_type = 'commerce_product';
}
}
Therefore, for entity reference field for those entities, the outer condition is met, while the inner not.
The following which consider all other entityreference fields is then skipped.
Active
2.0
Code