Postponed (maintainer needs more info)
Project:
Context
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
29 Sep 2009 at 13:53 UTC
Updated:
19 Feb 2011 at 22:27 UTC
Jump to comment: Most recent file
Comments
Comment #1
frankcarey commentedI'm kind of looking for the other way round... Use rules to set the page's context.
Comment #2
frankcarey commentedAhhh, rules integration. I *heart* APIs! Here is my hacked together rules integration module. I'm going to keep working on this to at least clean it up, but i figure others might like to check it out.
I am able to use the "Create Context" Action in rules where i set "namespace" and "attribute", and then you can follow it up with the "Set Context" to set the "Value" to whatever you want. In my case, I'm setting a context value called "people" when users are viewing a profile page that isn't their own. I won't go through the conditions, but the context values for the actions are like this (which are the defaults):
namespace: context_ui
attribute: section
value:people
I think conditions should work as well, being able to retrieve what contexts are set, etc. Obviously this opens up much more control over how contexts are set, and rules can be imported and exported and have features integration, so this can be a really powerful shift! @maintainers: do you think it makes sense to have this be a new part of context module?
Comment #3
frankcarey commentedhere is the module: NOTE this thing was hacked together over the last few hours and it's 1:41am. use at your own risk! However, feedback would be much appreciated.
Comment #4
amitaibuI have created a new issue #655516: Maybe context should leverage Rules? - which is and isn't a duplicate ;)
In this issue we speak about Rules integration -- allowing rules to set the context object.
In that issue I claim that Rules itself *is* the context module -- where context only needs to provide custom conditions and actions, and no need to have a context object.
Comment #5
frankcarey commentedWithout reading that issue :P I think that is right thinking... but really rules is a replacement for context_ui (or at least the part that sets contexts) not context module itself, which is basically a "state cache".
Comment #6
steven jones commentedWould be nice to get this into 2.x
Comment #7
steven jones commentedThe code needs some work.
I'm not sure the language used is the best, 'creating' a context here doesn't actually create a new context, just creates one for Rules' benefit etc.
This is probably best moved into a standalone bridge module, or the feature adding for 3.x.
Comment #8
sethcohn commented+1
Comment #9
watsonerror commentedCool
Comment #10
steven jones commentedThis should be against context 3.x, either as a new feature, or a bridge between rules and context.
Someone needs to pick this up if they are interested, otherwise this won't happen.
Comment #11
milos.kroulik commented+1
Comment #12
baff commented+1
Comment #13
thomjjames commentedHi,
I'd be happy to take this on and release it, if no one objects?!
I would say the module should initially offer:
A. Event - "A context has been set" (possibly the reserve too).
B. Condition - To see if a selected context is set or unset (pretty sure this should be possible)
C. Action - The is probably the most useful part allowing rules to set or unset a context or contexts.
Let me know if there's anything else that needs considering.
Cheers
Tom
Comment #14
thomjjames commentedWent ahead and made a new project for this: http://drupal.org/project/context_rules
Please file any features etc in the issue queue.
Cheers
Tom