It would be useful in certain circumstances to be able to use dates as conditions, e.g. "only enable this context from December 1st through December 31st" or "only enable this context from 7am to 10am".

CommentFileSizeAuthor
#1 context-n646110.patch2.74 KBdamienmckenna

Comments

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new2.74 KB

A patch that relies upon date_api.module because the core '#date' form field type always assigns a default based on time(). It overrides context_enabled_contexts() and doesn't enable contexts that are out of the configured date range.

steven jones’s picture

Status: Needs review » Needs work

This is a nice little patch that does open up a few doors, but here's how I reckon this feature needs to progress:

  1. Instead of being another thing clinging onto the context_contrib module, add a new context_date module (to the context bundle of modules) that looks after this date stuff, and can add date_api as an explicit dependency.
  2. While adding a date range to make the context active between is a nice idea, I can see other uses too, like having contexts only active on Mondays, or every other week or somesuch. It's going to get messy if we don't do point #1 first.
  3. I guess we need to be really careful with dates and times and checking timezones etc, do we give people the option of using the user's timezone or is it always the site timezone, etc?
steven jones’s picture

Status: Needs work » Closed (won't fix)

Yeah, just create an addon module.