0

I have a content type (product) with a term reference field (colour).

When I create a new product and select a colour I would like the display of that node to render the taxonomy items term name and an image that I've attached to each term + control the html markup.

Via the Display Suite module I've managed to render the term's title and colour on the node using "Rendered taxonomy term" format on the field (screenshot below), however I want more control in how the title and image are outputted in the html markup. This is halfway there.

[![enter image description here][2]][2]

The title and image appear right after each other in the markup (as it is correctly rendering the taxononmy term) but to achieve the layout the designer wants I need to be able to render the title and image individually (essentially separate fields "taxonomy title" and "taxonomy image" on my "Product" node's display, instead of just the single "Rendered taxonomy term" that I currently have configured.

Any help would be greatly appreciated.

Edit:

"Product" and "Colour" were just an example. In reality my site has a content type called a "lift" and it has a term reference field linking to a "location" vocab.

So if I add a "lift" and say the location is "Sydney" then when viewing that node I want to be able to pull the "Sydney" term's title and image..but as explained I need greater control over the positioning of the markup (specifically in relation to the "lift" nodes other fields)

Example of what I want the node to look like:

enter image description here

  • Can I ask u to provide image of what do u want it to looks alike? Are u using commerce module? – ar7max Aug 17 '15 at 9:11
  • Sure :) "Product" and "Colour" were just an example. In reality my site has a content type called a "lift" and it has a term reference field linking to a "location" vocab. So if I add a "lift" and say the location is "New York" then when viewing that node I want to be able to pull the "New York" term's title and image..but as explained I need greater control over the positioning of the markup (specifically in relation to the "lift" nodes other fields) Order of fields required: – Andy Aug 17 '15 at 9:37
  • Oh, my english is too bad. I tried to ask you about picture of end result that you r trying to achieve – ar7max Aug 17 '15 at 9:40
  • Hi, Andrew. Have you looked at accessing the term output via taxonomy-term.tpl.php? Granted, I'm not too sure about that particular view mode (I think it is Display Suite-specific) but it's worth a look if you haven't already. You can override it by copying the file over to your theme folder from the taxonomy module, then make a copy but rename it taxonomy-term--vocabularyname.tpl.php. – othermachines Aug 17 '15 at 9:47
  • I could but I don't think that will help me in this particular example because it's not just the markup of the term that I need to adjust. I need to be able to display the term's fields in and mixed with fields from the node referencing it. – Andy Aug 17 '15 at 10:18
1

Sounds like this this could be achieved with Inline Entity Display.

Overview
Make available the fields and text properties from referenced entities into the parent entity template and the manage fields display overview.

This should allow you to move individual fields from your referenced taxonomy terms aroung independently on you node's manage display setting page.

  • Thank you. Might work. The only thing is the referenced entity is a term reference. I wonder if that is supported. – Andy Aug 17 '15 at 9:48
  • It doesn't explicitly state the term reference is supported but if not have you already populated the content or would changing this to an entity reference be an option? – Paul Querol Aug 17 '15 at 9:57
  • Hi Paul, no it needs to be a taxonomy (to my understanding) as I'm using the terms for grouping and filtering the content across the site with views. – Andy Aug 17 '15 at 10:13
  • It can work as taxonomy term even in Entity Reference field. You can add Entity Reference field. Target - Taxonomy Term. Choose vocabulary and check "Taxonomy index". All these settings presents on creating Entity Reference field – ar7max Aug 17 '15 at 10:24
  • 1
    thank you ar7max I'll try this. Thank you for all your help I appreciate it. – Andy Aug 17 '15 at 10:49

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.