Adding separate Striping / legend colors per field would be a nice feature.

Use case:
My nodes have 2 date fields, deadline-date and publication-date.
Using the CONTEXTUAL FILTERS and checking both fields generates 2 Calendar Entities nicely, but both have the same color.
Now it is not clear which meaning each date has.

Members fund testing for the Drupal project. Drupal Association Learn more

Comments

johnv’s picture

Title: Add Striping bases on Field » Add Stripe / Legend based on Field_name

cross-posting:
this issue has the same question for new striping aglorithms: #486794: Possible to add other fields to Legend?

johnv’s picture

I created a patch for this, which is included in #1392306: Code cleanup for striping

KarenS’s picture

Status: Active » Closed (duplicate)

#1392306: Code cleanup for striping has a patch so this is a duplicate.

KarenS’s picture

Status: Closed (duplicate) » Active

The new stripe feature got removed from that patch, so re-opening this as a feature request. If you want to propose this, it needs its own patch.

johnv’s picture

Status: Active » Needs review
FileSize
6.63 KB

Please find my patch attached.

johnv’s picture

Discard the patch from #5. Attached a new version.

johnv’s picture

johnv’s picture

test, test, test

johnv’s picture

Status: Needs work » Needs review
FileSize
5.32 KB

Better version. #8 is OK.

KarenS’s picture

Status: Needs review » Needs work

I tried this out but I'm having trouble getting this to do anything, or tell what it ought to be doing. It adds an option to use a date field and then gives me no place to select which date field to use. I just get a single textfield where I can set a color but I can't tell what that color will apply to and I can't set different colors for different fields.

KarenS’s picture

OK I figured out that if I add a second date field I can give it a color. But if my date fields don't have labels I can't tell them apart (that's why I couldn't tell what the textfield was for). Also the stripe has no effect for me after I select a color.

So I guess this needs some work yet.

johnv’s picture

Status: Needs review » Needs work
FileSize
6.49 KB

The module changes of April 18 made some changes necessary.
Patch from #9 was not correct either. See attached new patch.

This functionality can be used for every Entity type that has +1 date fields, like a summer course:
- registration start date
- course start date

Some remarks regarding the patch:
- the last line of the patch removes a superfluous line of code.
- The changes of April 18 in theme.inc (function theme_calendar_stripe_legend) introduce some duplicated code. Is it an idea to move the " switch ($legend_type) {...}" part to calendar module, into a function calendar_get_optionlabels(&$display_handler, $legend_type) ?
The we can use this to remove duplicated code to determine the labels.

johnv’s picture

Status: Needs work » Needs review
stevebab’s picture

Good patch, great idea, and it works well for me. Any chance of getting it committed?