1

I'm using field collection in my content type Recipe. In my field collection, there is a term reference (ingredient) and a text field.

When I create a Recipe, I add terms (ingredients) with the field collection. But when I visit the term page (ingredient X), no recipes are listed even if this ingredient is used in a recipe.

I think the problem comes from Field collection : the term is linked to the field collection but not to the created content.

How do I display all the recipes linked to an ingredient when I visit a term page ?

Sorry for my bad English, i'm not sure i'm clear.

0

This is because the default term page implementation in Drupal 7 is querying node relationships, it has no awareness of relationships to Field Collections that are related to Nodes (or potentially, other entities).

You would have to solve this yourself by using a module like Taxonomy Views Integrator, which lets you create Views and set them as the term page view instead of the default Drupal page callback which won't ever work in this scenario.

You can follow why you aren't getting hits from Drupal core here. Hence, you need to override this presentation.

So, if you use TVI, you'd want to create a View that selects field collections with relationships to terms and nodes, and give it a contextual filter of taxonomy term id from URL (assuming taxonomy/term/%tid path). This should get you results, and let you link to the node. I don't have a sandbox setup to try this out, so you may need to experiment on the View formula.

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.