By gmak on
At the moment, it seems like the event module either chooses random colours from a set, or cycles through a set of colours for the stripe at the top of the event items on the calendar views.
I'm wondering if anyone has been able to make these stripes related to the node type?
I have four node types and I'd like to colour code the events in the calendar to relate to these.
Any suggestions?
Comments
Here is one way to strip by content type.
In event.theme you will find functions like theme_event_node_week() with
Note there are several functions that do this based on what calendar view is being show.
What I did was take each of those functions and add them to my themes template.php file (if you do not have one you can create it.
You will need to change them so instead of starting with 'theme' they start with phptemplate (ex: theme_event_node_week becomes phptemplate_event_node_week)
Then replace the stripe code with something like
The key part is
$stripe_map[$node->nid]becomes$stripe_map[$node->nid]. You will then need to provide the appropriate css rules to color and size the stripes.A Little More Explanation Please
I understand principle of what you're suggesting, but I'm not clear on how to check the node-type that is being used. Could you expand your explanation a bit more to include that part?
You say
But those are exactly the same. What should
$stripe_map[$node->nid]actually become?Please excuse my relative inexperience with the API and thanks for your help
Sorry, that is a typo
That should have been: the key part is $stripe_map[$node->nid] becomes $node->type. You will then need to provide the appropriate css rules to color and size the stripes.
How does this reflect in the style sheets?
Any chance you can quickly elaborate on how this is supposed to look like in the style sheets? I've done the changes to my phptemplate. Now, lets say I've got a node type called short_events. How would the stripe color for this event type exactly be defined in the event.css?
I've tried something like this:
that doesn't work. I've tried other lines as well but I just can't get it working.
Any ideas?
cheers, xl
I've found it out...
My problem had to do with some slight confusion about the changes in the output variable of the phptemplate function. To make it 100% clear, the line...
...turns into...
Then you can go into the event.css and define your classes like this:
content_short_event being my node type that I want to have with a stripe in a specific color.
xl
Subscribe
Subscribe
I implemented your change --
I implemented your change -- But now I have 3 questions based on the results:
1. When I do this (I'm working in 5x), I see two drop down menus: "Select event terms to filter by" & "Select event type to filter by". This isn't all that meaningful to me, because I can either decide to add new content types per type of event, or to add categories for each type of event (and apply these different categories to the event content type). So would rather not show both. How do I hide one of these drop-down menus?
2. Also, now I see a link with the name of my custom event type - the alt text says "limit view to events of this type", which seems to be another way to filter the calendar. How do i hide this?
3. Ideally I'd like to change the color by category rather than by content type. Here's why: the problem with making custom content types just so we can color-code them on the calendar is if I want to change the type of event I'd have to re-make the content using another content type! Whereas categories can just be re-assigned without having to re-create the content. So my last question is - How would you change the color by category?
Thanks -
Scott Rigby
http://basekamp.com
http://PlausibleArtworlds.org
Scott Rigby
http://basekamp.com
http://PlausibleArtworlds.org
http://UtopiaSchool.org
Answer to #1
To hide "Select event terms to filter by" & "Select event type to filter by" go to Administer> Site configuration>Events>Event Overview.
There are two sections "Taxonomy filter controls" and "Content type filter controls". There's an option to "Never show" for both of them.
I'd also like to know how to change the color based on event category... (your #3)
Unfortunately, It still does
Unfortunately, It still does not work for me. Nothing has changed. Perhaps you are using another release?
A patch
Finally I found a patch:
http://drupal.org/user/211194
It works well.
patch?
That's a link to a user.. not a patch.. or am I missing something? :\