Currently, it's impossible to create a legend based on taxonomy terms if they are referred to by using an entity reference field (instead of a term reference field).
Adding support for entity reference also allows to create the striping/legend based on other entity types (as long as there are not too much entities that can be referenced by the field).



Stevel’s picture

Status:Active» Needs review
new7.75 KB
Stevel’s picture

Added a comment, some code style fixes, Added a check_plain().

BWPanda’s picture

Issue summary:View changes
Status:Needs review» Reviewed & tested by the community

This is awesome! It worked perfectly to allow me to colour nodes with different taxonomy terms referenced via entity_reference.

abx’s picture

#2 work for me


pbcelery’s picture

Any documentation possible with patch? I'm not having success with a taxonomy legend using the referenced node's terms.

My trial, for reservations, keelboats, and keelboat's terms-

  1. Create view (type calendar).
  2. Format: Calendar, style Calendar entities
  3. Contextual filter: Date, using reservation dates
  4. Relationship: field_reservation_keelboat
  5. Fields: keelboat_terms

I'm not having luck using the relationship or terms for a legend though. Thanks for any advice.

Stevel’s picture

I Assume the field 'keelboat_terms' is an Entity Reference field here.

After adding the field:

  1. Click Settings next to 'Calendar Entities'
  2. Legend Colors -> Stripes: choose "Based on Entity Reference"
  3. Entity Reference Field: choose your field 'keelboat_terms'
  4. Set the colors for each entity that can be referenced by the field 'keelboat_terms'

I think you need to save and re-open the Calendar Entities Settings page between step 2 and 3 or between step 3 and 4.

pbcelery’s picture

I'll try it - many thanks.