1

I'd like to make an entity reference autocomplete field where I can only select the options which have a certain taxonomy term attached to it.

Example: I have a sports player who belongs to a certain team. The player is part of content type 'person' with taxonomy term 'player'. Other taxonomy terms which can be applied to this content type are 'referee' and 'trainer'.

I also have content type 'team' where I want to be able to select players for this team. I have used an entity reference field for this which refers to content type 'Person'. But now I can select all persons, so also referees and trainers.

What I did now was create a View with content type=person, term=player and saved this as an entity reference display. I can now select 'Views: filter by an entity reference view' in the reference field in Teams. This all works fine.

The problem however is, I'd like to quickly add a new player if the player isn't in the database yet. I installed the References Dialog module, which adds buttons to an entity reference field to add or edit nodes you're referring to. This module only works when you select the Simple entity reference and not the Views entity reference.

Any solution for my problem?

1

Here, start with creating a new view and be sure to select taxonomy terms.

In short: - Add new view - Select: Show Taxonomy Terms -> Save & Continue - Fields: Entity Reference View Widget Checkbox: Taxonomy term - And ofcourse Taxonomy Term

Go back to your contenttype page and be sure to select the right view with your entity referece field.

Cheers,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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