I have a content type 'order' with 2 entity reference fields. One is a reference to another content type 'brand' and the other is a reference to a taxonomy term 'categories'.

Now the content type 'brand' has an entity reference field aswell, containing a selection of taxonomy term 'categories'.

When creating a new 'order' I can select a 'brand'. Now the second field with the 'categories' should only show taxonomy terms available (selected) for the selected 'brand'.

I have tried to achieve this with the second entity reference field (categories) to use a view.

In this view I configured the following:

Relations: - Content using field_categories - Content referenced from field_brand

This worked when I had only 1 brand, since this brand was not connected to all categories. But now with multiple brands, the view just returns all the terms used in ALL brands.

Any idea how to achieve what I try? Any help is very appreciated. Thank you!

1 Answer 1


This isn't easily possible at the moment with the standard widget/autocomplete API as it has no context from where it is referenced.

To get something like that, you need a custom widget, one that supports to pass an argument to the views query based on your current node and then you need to connect it with your other field so that setting/changing a value there sends an ajax request to update your other widget, which then needs to get that value and pass it along to the views selection plugin.

Some related core issues: * https://www.drupal.org/node/2776571 * https://www.drupal.org/node/2280479

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.