Question

I have a taxonomy term reference field in a node (D8).

I have a content (node) view that needs to use a content display rather than fields.

The term is selected, but not the custom fields that have been added to the vocabulary (see the query, below).

The display settings for the vocabulary have all the fields being displayed.

I thought perhaps there was a relationship that I could add that would result in the fields being selected. The only applicable option is for Taxonomy term, which I have added. It results in the taxonomy_term_field_data being joined, but not the custom fields.

Do I actually need to hook the query before execution to add joins for the additional fields?

SELECT node_field_data.created AS node_field_data_created, node_field_data.nid AS nid, taxonomy_term_field_data_node__field_tags.tid AS taxonomy_term_field_data_node__field_tags_tid
FROM
{node_field_data} node_field_data
LEFT JOIN {node__field_tags} node__field_tags ON node_field_data.nid = node__field_tags.entity_id AND (node__field_tags.deleted = '0' AND node__field_tags.langcode = node_field_data.langcode)
LEFT JOIN {taxonomy_term_field_data} taxonomy_term_field_data_node__field_tags ON node__field_tags.field_tags_target_id = taxonomy_term_field_data_node__field_tags.tid
WHERE (node_field_data.status = '1') AND (node_field_data.type IN ('article'))
ORDER BY node_field_data_created DESC
LIMIT 1 OFFSET 0
Was it helpful?

Solution

The Default Content View mode is controlled through the Manage display page of the related Content Type.

Check that page and make sure that the Taxonomy Term reference field is set to Rendered entity and not Label or some other option.

The Rendered entity option will make sure that all the Vocabulary fields set to be displayed for terms will also appear under Content rendering of the Content type.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top