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).

Files: 

Comments

Stevel’s picture

Status: Active » Needs review
FileSize
7.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

Thanks

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

@pbcelery:
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.

afranioce’s picture

+1

fizk’s picture

Status: Reviewed & tested by the community » Needs work

The Drupal-core Form API doesn't provide "#dependency", that seems to come from a contrib module like Form Dependencies.

We should rewrite this patch to use #states.

Stevel’s picture

@fizk: I got the #dependency from the code that already exists in the module now: it is also used in the other legend options (taxonomy, og, ...).

It seems to come from ctools. See http://www.drupalcontrib.org/api/drupal/contributions!ctools!includes!de...

Stevel’s picture

Status: Needs work » Needs review

Back to needs review

fizk’s picture

Status: Needs review » Reviewed & tested by the community

Thanks Stevel. Setting back to RTBC.