Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#12 | calendar_1394362_12_datefield_striping.patch | 6.49 KB | johnv |
#9 | calendar_1394362_9_date_field_striping.patch | 5.32 KB | johnv |
#8 | calendar_1394362_6_date_field_striping.patch | 5.71 KB | johnv |
#7 | calendar_1394362_6_date_field_striping.patch | 5.71 KB | johnv |
#6 | calendar_1394362_6_date_field_striping.patch.txt | 5.71 KB | johnv |
Comments
Comment #1
johnvcross-posting:
this issue has the same question for new striping aglorithms: #486794: Possible to add other fields to Legend?
Comment #2
johnvI created a patch for this, which is included in #1392306: Code cleanup for striping
Comment #3
KarenS CreditAttribution: KarenS commented#1392306: Code cleanup for striping has a patch so this is a duplicate.
Comment #4
KarenS CreditAttribution: KarenS commentedThe 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.
Comment #5
johnvPlease find my patch attached.
Comment #6
johnvDiscard the patch from #5. Attached a new version.
Comment #7
johnvComment #8
johnvtest, test, test
Comment #9
johnvBetter version.#8 is OK.Comment #10
KarenS CreditAttribution: KarenS commentedI 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.
Comment #11
KarenS CreditAttribution: KarenS commentedOK 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.
Comment #12
johnvThe 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.
Comment #13
johnvComment #14
stevebab CreditAttribution: stevebab commentedGood patch, great idea, and it works well for me. Any chance of getting it committed?