When I wrote the panels content type to allow adding of cck fields to panels, the biggest problem was that the the forms had no way of knowing what types of nodes were available.

So on a system with 100+ fields is becomes very unmanageable with that many fields.

I also have another content type that I am working which will have no real context past to it, but just parameters on where to get the bulk of the information.

I have mad a change so that the when context is created it will pass the context parameters to the creation of the context object. Then if needed these parameters can be added to the object.

In the patch I have done the node context so that it includes a property for the node types.

Then the contexts are then past to the add and edit forms so parameters can be adjusted at will. So in the case of cck 5.x-1.7 the list of fields can be reduced to those that are attached to the node types listed in the contexts.

All the contexts are past as you man have multiple node context types which will impact on the parameters.

I think this is pretty good, but the addition of the context configuration needs to be done for all types. The other things we could just add the config to all contexts.

This will really help clean up cck and other content types.

Comments

sdboyer’s picture

Interesting ideas here. I'm getting on a plane in a few hours to get back home & to my usual dev environment, but this is the area I was working in before I left, so expect some movement on this (in some direction, I haven't grokked your changes so I don't know what yet) presently.

merlinofchaos’s picture

What I had in mind was a more generic system:

All nodes will have the context 'node', 'node-unknown'. Nodes where we know what the node type(s) can be will also have 'node-NODETYPE'.

Then required_context('node-story', 'node-unknown') will basically just work.

gordon’s picture

This sounds interesting. and would work great for nodes.

The problem is a new content type that has a context. And I need to get the context configuration from the context so that I can format the forms.

Gordon.

gordon’s picture

I have been thinking about this more, and being able to filter by the context is great, but also the ability for the content types to know about what context is available means that we can do more with the content.

gordon’s picture

StatusFileSize
new4.38 KB

Here is an updated patch.

sdboyer’s picture

(mostly @ gordonh)

Just a quick update - I'm probably 80% of the way through a pretty hefty rehash of the core functions that handle content type/pane editing, so while I haven't technically gotten to this yet, it's worth noting that I'm feeling pretty good about putting it, or something quite like it, in for beta4. As Earl pointed out, there are ways the basic goal could be accomplished simply by extending the existing node context a bit, but as you point out - and I think I recall Moshe pointing out at some point a while back too - there are other interesting & powerful potential benefits from making $context available. Furthermore, given that it's a pretty small API change...well, I'll post again when I've actually looked directly at it, not just thought about it while working in related areas.

sdboyer’s picture

Hmmm...ok, I need to retract at least some of that enthusiasm, but I'll get back to this as soon as I can.

sdboyer’s picture

How's the progress with this? The new callbacks are available for you to use, if it's of any use...

gordon’s picture

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

Hi,

I have my module working, but I needed to use global to get around the fact that I needed to know what panes are available based upon the context.

I did find that under some of the ajax situations the context was not created, therefore I had problems with my config.

sdboyer’s picture

Ugh. Would you mind posting the code you ended up with? I'd like to have a look at it and, as promised, reconsider my thinking about the potential API expansion.

summit’s picture

Subscribing, greetings, Martijn

gordon’s picture

Status: Closed (won't fix) » Needs review
StatusFileSize
new1.79 KB

Since I have not seen this yet, here is a patch which adds the node types to the context so that you can specify content based on a node type.

This does it using the method that merlin recommended.

sdboyer’s picture

Status: Needs review » Fixed

DAMMIT ALL, I wrote a really great detailed response to this, then d.o freaking recycles my login and I can't get the whole thing back. AND I don't have the time or patience to rewrite it...URRRGHHHH

Sorry, I've been up too long. Summary: committed, but there's more work that needs to be done. If you could get in touch with me on IRC, gordon, that'd be great.

gordon’s picture

Status: Fixed » Needs review
StatusFileSize
new546 bytes

I actually missed one part which is that if a node is added as a context eg $data = $node then it also needs to add $context->type = 'node-'. $data->type

sdboyer’s picture

Status: Needs review » Fixed

Committed.

Oh, and tsk tsk...coding standards! One space on either side of the concatenation dot...I fixed it from your patch in #12, too :P

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.