I'd like to be able to set context based on whether or not a given node references a particular other node.

CommentFileSizeAuthor
#2 nodereference-284871.patch2.32 KBpasqualle

Comments

yhahn’s picture

Assigned: Unassigned » yhahn

Hi Moshe,

This is an interesting request. As you may have noticed the current context_ui setup isn't very friendly for these kinds of open-ended associations -- however I'll be looking soon at making the UI more accommodating for additional widgets (in this case textfield + autocomplete).

Once that refactoring is ready nodereference integration should be fairly straightforward.

pasqualle’s picture

Status: Active » Needs review
StatusFileSize
new2.32 KB

version: 6.x

quick solution with checkboxes

pasqualle’s picture

Title: Set context based on a node reference field » Integration with CCK node reference module
Version: 5.x-5.x-dev » 6.x-1.x-dev
moshe weitzman’s picture

Based on a quick reading, this is a bit different from what I had in mind. In the UI, i want to select node ref field that will determine context. Then contextwill automatically be set to the value of that node ref field when viewing a node detail page. Should work for multiple fields as well.

@Pasquelle - What is the use case you had in mind?

pasqualle’s picture

you can set up a context "mycontext" for nodes which are referenced to node x (with selecting a referenced node from a list)..
so for example you can show up a special block for these nodes.

so, you would like to select from a list where node reference fields are listed by name? and if a node have that field then setting a context?

moshe weitzman’s picture

"and if a node have that field then setting a context?". i think you have it right. i would rephrase - if a node has any values for that node reference, then set the context to be equal to those values.

In a sense, my suggestion does the same as yours with 1 context for all values whereas yours has a new context for each possible value.

moshe weitzman’s picture

I think that the solution I proposed is not compatible with the Context UI notion whereby each value gets setup independantly. That sometimes makes no sense, especially for Setters.

So, Pasquelle's patch makes more sense to me now. Disregard mine.

yan’s picture

I'm not sure if I'm just blind, but I still can't find this in 6.x-3.x. Do I miss something or has CCK compatitbility still not been implemented?

liquidcms’s picture

i have just started looking at Contexts in D7 and i also do not see any field support for conditions - for any type of field.

also, seems like some other basic conditions are missing:

- user in role
- php (so any odd condition could be set; like the missing does this field have value X)

but again, very new to contexts - so maybe missing something.

liquidcms’s picture

my bad.. role support is there.