I don't really know what the "politics" of module and feature development is or how things are co-ordinated, but I discovered today that the "Context" referred to by the ChaosTools/Panels world is not the Context module. Maybe this is just a timing issue, but I really think it's important this be given some thought, quick, before too much confusion abounds.
I have no allegiance or reason for favoring either, and as a total outsider, here are some observations (and I may be wrong, but here goes)...
- The notion of context is a powerful site design tool. So powerful, that I can easily imaging many, many modules exploiting this to coordinate content display.
- It appears that the "context" supported by Chaos Tools does not provide a management UI for contexts which is independent of panels and the rest of Chaos Tools.
- If Chaos Tools context is extensible by other modules (which I assume it is), then there don't seem to be many modules using it, whereas the Context module is accumulating a small but loyal following of other modules supporting it.
This put us into quite a quandary. We'd LOVE to use the new Panels 3.0. However, the context support in Chaos Tools isn't nearly so comprehensive as that provided by the Context module, which we are already using (with amazing success). Instead, it appears to only provide limited context support within the "Panels world". If there is a UI that allows us to define and manage contexts for our entire site, please let me know, as we couldn't find it.
Moreover, it appears that Chaos Tools and the Context module are both duplicating a pretty essential site concept, in different ways, with little or no apparent communication. And, when searching the web people are using the word context to refer sometimes to one module, sometimes to the other. While everybody seems to embrace the concept it appears that a good implementation is going to be hampered by the "multiple chefs" phenomenon instead of agreeing on a separate, well-debugged API that everybody can use.
At this point the Context module appears to have a more pervasive feature set. But, it has problems that need addressing, particularly in the UI and terminology. But, I can say personally that is has solved myriads of problems in our complex site design and is reasonably solid technically. Maybe we could have solved all those problems if we had adopted Panels/Ctools months ago, but I don't think CTools context has the feature set or same architectural vision that Context does.
So now, all we can do is *sigh* and wonder if we just have wasted three months of development on adopting pervasive support for the Context module in our code. Which will win? Which will lose? Will they be compatible? Will there be two different ways of doing things tied to families of compatible and incompatible cousin-modules?
Please tell me that I am totally wrong and there is some brilliant scheme for adopting a site-wide Context API that empowers all modules and that this is just a temporary situation. I really don't want to have to discard the entire CTools/Panels3 world of modules just because it doesn't work with our existing commitment to the Context module implementation. I also don't want to throw out our existing context implementation too casually (months of work in some of our site-specific modules that use the Context API), if CTools/Panels3 rewrites aren't going to be the dominant way of doing things.
Comments
Comment #1
merlinofchaos commentedI haven't had the time to go look into context.module.
All I can say is that Panels was using a system named context back in 2006 and I am not likely to change. I don't entirely know what its featureset is. I do have a long term architectural vision, and that vision includes making the 'block' interface something you will never want to see again. From what I understand, context.module basically tries to make the block interface more usable. I've heard mixed reports as to its success.
The context developers have made no effort to contact me or do anything, and since context.module is johnny-come-lately to me, there really isn't a lot I can do. I don't really have the free time, between Views, Panels, a job and family, to go and actually do more. And I'm very sad that they chose to discard my work without having ever looked at it. But I have no control over that.
I would like a site-wide context API. I fear that the fact that I want to do things completely differently from Drupal core, and the addition of context.module means that we're just going to end up with a fairly large split in how things are done until one or the other truly wins is just how it's going to be.
I'm not sure what a site-wide management of contexts UI would look like. My vision of contexts is very much focused on a per-page setup, but it's entirely possible that sdboyer's idea of blueprints will be another gamechanger. If he ever gets the time to write it.
Comment #2
merlinofchaos commentedAnother thing I don't know is whether or not there is some room for context.module and CTools idea of context to work together. Maybe there is, maybe there isn't. The two currently operate on a different scale.
Comment #3
garywiz commentedIt's not really a matter of what came first, I'm just noticing a problem that I think is a real one, and I doubt that anybody specifically tried to ignore anything or duplicate efforts, but it's happening anyway. Ironically, it's made a bit worse by the fact that the Context module is actually quite good! (Needs help, but very good.) If one implementation were bad, it would be easier. :-)
I also understand the home/family/kids thing and there is only so much that can be done.
We are actively working and coding with the Context module API now and it is having tremendous site benefits, so maybe we can work more actively to see whether there is some integration method or other way to assist. I'll post issues if it becomes relevant to progress, and thanks for the observations.
Comment #4
merlinofchaos commentedSomeone on IRC mentioned that they do use Panels/CTools and context.module together on a site. Though obviously context in one doesn't translate to context in the other.
Comment #5
garywiz commentedYes, they appear work side by side without conflict.
I installed the new CTools/Panels 3.0 combo and they worked fine (very fine, indeed). The only problem is that we now have a pretty sophisticated site-plan which involves contexts as a driving force between how we will design and manage our new sites. Our developers know the word "context" as meaning something quite specific, and go right to the context module's settings page to manage various criteria which will cause blocks and pages to respond the way they want.
I suspect we're using contexts more than most. We have three separate context "namespaces" that we invented based upon our site plans:
* Focus (either community, promotional, or general)
* Page type (episode, community, show, forum, feature)
* Site (entertainment site, business site, insiders site) - we use domain tools to manage this across sites
So, our site design team laid out the sites so that the focus, page type, and site dictate what modules, "QuickTabs" blocks, page extras and menus should appear. It has been extremely good for creating a great information architecture template, and the whole "context" methodology has saved countless hours in trying to identify how certain page characteristics should be distributed, since context makes those characteristics quite literal.
In fairness, I have not used Panels since Panels 1.0, so I can't really contrast how we would have approached the site design. I suspect if timing were different we would have tried it both ways, but we are too far along now. I just point out the above as food for thought in considering how contexts were used by us, and I suspect by some others.
Comment #6
sdboyer commentedFirst, let me just clear up the technical point definitively - these two implementations of 'context' have nothing to do with each other, are architected towards different problems and operate within different paradigms, and the circumstances under which they collide are more coincidental than systemic. Now, the less pleasant bits.
Let me preface my comments by noting that the question over the context namespace is more of a sore point for me than it is for Earl. Let me also note that does not put me in a very receptive mood when you start out by describing yourself as "a total outsider" with "no allegiance or reason for favoring either," then proceed to lay out considerable experience with Context, but later reveal that you haven't really used Panels since 1.0. I have tried to make a point of seriously listening to folks when they want to talk to me about their experiences with context.module. But misrepresenting the the weight of your experience encourages me to perceive your case as disingenuous, not balanced.
There is a fundamental conceptual difference between the two approaches, one that I often describe as the difference between a "pull" (ctools/panels) and "push" (context) approach. The "push" approach is well characterized by one of your sentences:
Context.module is essentially extending the concept of block visibility rules - when a block visibility rule is met, the block is shown, or 'pushed' out onto the page. Similarly, when the criteria for a context is met, changes to the output are 'pushed' out onto the page.
Panels has another layer - the panels display. It is due to these panels displays that Panels follows a 'pull' paradigm, whether or not there's any context involved - they're nothing more than an organized set of rules for pulling together, laying out, and styling content on a given page from a whole bunch of different sources. When a context is passed to the display, it's the panels display's rules that determine what additional content might be shown or hidden (pull), rather than the context itself deciding (push).
Note that pull vs. push are loose concepts and that the lines get murky under intense scrutiny. But the basic point is useful - the current primary implementation of ctools' contexts (Panels) is to hand data objects over and let the display handler figure it out; the underlying idea is about giving more data to the logic that's ultimately responsible for content rendering for that logic to do with as it pleases. The current primary implementation of Context, afaik, is about directly adding content to output via regions & the theme layer, the overall goal being the establishment of a sectioned experience. Again, these are the PRIMARY implementations, not an exhaustive account of what is possible with each system. But, as Earl and I have both said, the bottom line is that the current primary implementations operate in a different scope and with a different focus. I prefer a pull-based system, which makes it a no-brainer for me.
Having been through this discussion a few times, there are two potentially useful points I've come up with. First, YES, integration is possible. I'm not sufficiently up on context.module to be able to suggest ctools->context integration, but for context->ctools, I could see either of the following:
Second, I think there are several discussions at very different conceptual levels going on in this thread, and that it's important we name it. ctools context is an API-level tool, which makes it (almost by definition) not "featureful" in the way that context.module is. The question - and it's an important one - of a global drupal context API/system/whatever is only marginally relevant to the term confusion at the UI level you've described. Either one of these systems could operate using the same underlying global contextualizing system, and coming up with one wouldn't resolve the ambiguity; one moves data objects around, the other pushes content. And I don't know how to say it without sounding snarky, but I think it's worse to leave it just implied, so Jeff, Young, Alex, et. all, please forgive me: in a situation where the same word is being used to describe two definably different concepts/processes, it does matter which came first. So garywiz, I think it's great (_seriously_) that context.module worked so well for your project, but the fact is, namespace is the only thing your approach really shares with the approach embodied in ctools' context.
Comment #7
garywiz commentedThanks for your well thought-out reply and I apologize if this issue has been rehashed many times.
I think both context implementations are far closer in vision than you think:
One strength of the Drupal community has been to identify strong base technologies (such as Views, CCK, etc.) and gradually migrate them to be more and more central. Of course, this saves code, saves time, and consolidates thinking around reusable APIs.
The notion of context is reaching a critical mass where lots of code and lots of time could be saved if it were consolidated into a good API, otherwise module after module will implement "contextual knowledge" in its own way.
While there are clearly different implementations, consider that code which builds a Drupal page may need to know:
I believe the list could be expanded to three times that size, or more. Worse, when deciding what should or should not appear on a page, the UI contains many redundant ways to do so, and developers must know a dozen different APIs and ways of detecting "context". The amount of code in Drupal across all modules to determine page context in ad-hoc ways is growing fast, and the amount one needs to know to build a complex page is growing along with it.
So, regardless of when they were both "born", both the Context module and the CTools context API provide a consolidated way to (a) aggregate context definitions into a single, extensible model and to (b) have a single way to test them. The point of my issue was not to say that one is better or one is worse, but to understand why multiple APIs are being developed to do, at some level (the name space level) the same thing, and whether one was going to be more widely adopted or not.
I appreciate your well considered reply and did not mean to appear "disingenuous". Maybe you misread my meaning when I said I was "an outsider" and had no allegiance to either module. Being an outsider to the community doesn't mean I lack experience. Just because I have worked with the Context module on our site doesn't mean I favor it or believe it is better. It has problems. I'd like to try an alternative, and have looked pretty extensively at the CTools context mechanism to determine how I could use it instead. And yes, I haven't worked with Panels actively since 1.0. I don't count "casual use" as experience. I have installed Panels 2 and 3 and used them quite extensively, just not in a production environment on a major site.
It sounds like the conclusion at this point is that there are many different ways of doing this, that the word "context" is used in different ways by different projects at different times, and there is no agreed-upon effort to create or use a single API.
Everybody has limited time and can't solve the worlds API problems. I do have some time to spend on this however, and the main purpose of my issue was to clarify where things are so that, if I do try to contribute patches or solutions, I do so in a way that's productive.
Comment #8
sdboyer commentedIt's starting to really seem to me like you're not listening, and when folks stop listening, I tend to stop having conversations. But I'll allow for the possibility that we're just talking from really different perspectives about this and try again.
I shouldn't have said anything about API-level vs. non-API level; it's subjective enough that it just muddies the lines further, and I don't want to go there. Other than that, you're really just rehashing parts of the points I made about why they're different. And I'm sorry, but your belief about the 'bias' of each code base is...well, a belief. It's not evidence in support of your position that the implementations are closer than I think.
This isn't a substantive similarity, it's just a good design practice. It's like saying "these modules are similar because they invoke their own hooks."
Again, not a substantive similarity with respect to this discussion; it's mostly just good design practice. It makes the _vision_ no more similar than two segments of code utilizing a Visitor pattern.
Time saved? Maybe, even probably - at least, after a huge investment of time up front. But code saved? These are generalizations, not arguments; you need to point to the duplicated code that could be unified, not just abstractly claim it's there. Again, just because they're both called 'context' doesn't mean they have so much overlap that we're both going to automatically experience a gain by unifying code.
First, let me just note - I wrote the context integration for og with ctools (though I wrote it eighteen months ago back when context still lived in Panels), and it is hardly "managed" in two different ways. It's same thin ctools context wrapper around the _exact_ same approach og itself uses to defining context - thereby enabling communication between og and panels/ctools. Which is what ANY attempt at a Grand Unified Context API will ultimately do - take contextual information and hide it behind a unified, accessible interface.
With that out of the way - I have a mixed reaction to this list. On the one hand, you have indeed illustrated the diversity of information that drupal needs to be cognizant of on every page request. And you're right that it is taxing on developers to need to be aware of all of the different means of doing it. But just because we can rope it conceptually into something that one can make a cogent argument counts as 'context' doesn't mean it should all be unified. Here's a counter-list:
The point is, almost ANYTHING can be considered context. Can you draw a clear line? I can't. Whether or not stuff gets called contextual has more to do with whether or not its relevant to what you're trying to do right now than any objective characteristic of the stuff itself. Sooner or later (and in my experience, it's sooner), wrapping stuff up to make it looks the same just ends up bloating everything and simplifying nothing. And, take the third item in that list - the user's session id. We do provide some methods for accessing that that protect the session information - those methods simplify working with sessions, which is part of why we do them, but we also do it to ensure stability and consistency in places where foregoing it could be, in this example, security risks. Not just 'cuz they fit Merriam Webster's definition of 'context.'
Once again: we use ctools context to manage an enormous range of logic and data-moving problems in a systematic way within ctools, Panels, and other modules - and these points you're focused on are 85-90% irrelevant to that logic. I'm not remotely opposed to a Grand Unified Context API. I'd love it. I'm just trying to communicate to you that these two modules do really different things, and even if you don't believe it, coming up with such a grand unified API would not solve that problem. And also, maybe, highlight why pushing for changes to the 'context' idea that don't account for a large portion of what we use it for makes me more than a little uncomfortable.
As I've said, namespace collisions and general similarities do not very similar, or even reconcilable, modules make - but your entire post here is premised on the idea that they ARE very similar, and reconcilable at a far deeper level than they are. In other words, your initial assumptions weren't correct. And I've already explained why these very basic differences makes the namespace collision even more of a sore point.
http://drupal.org/project/usage/ctools
http://drupal.org/project/usage/panels
http://drupal.org/project/usage/context
I also grepped over contrib to see what sort of dependencies I could find (note that this comparison does disproportionately favor ctools/panels, at least because there's a LOT in ctools besides context) Here's what has dependencies on context:
And on panels/ctools:
OK, thanks for clarifying.
There's no agreed-upon effort because, at minimum, no one has made a convincing case that the marginal benefits outweigh costs. And I'd welcome patches - it would give us something concrete to talk about. But I'll also put out the caveat that I think you need to be a lot more precise about what problem you're trying to solve before you start rolling patches - I'll definitely be a lot more receptive.
Comment #9
garywiz commentedWell, I think you've been pretty receptive so far, so thanks.
I don't think the benefits are marginal at this point, mainly because I see code being written to solve the problem of visibility contexts in a generic way, and people gradually adopting it. Such efforts appear to reflect a growing need. Yes, I think it's early to claim that a sweeping context management framework is a high priority. It's a low priority in the grand scheme of Drupal's framework. But, noticing it early and discussing it can't be a bad thing.
Here is a rough start at pinning this down: "Any time a visibility condition is exposed to the user by more than one independent module, it is a candidate for integration into a context framework."
This cuts to the core of why a context framework is useful and helps tell the difference between the "server's php version" and the "path template for the current page". The latter is consistently exposed in the UI for making decisions about content visibility, the former is not. The only real reason for considering something context is because it is being shown to users as part of their page-building toolkit.
I'm not sure whether code is saved and that is a tough argument to make soundly at this point, I agree. But, complexity for the user is reduced and a methodology is created that saves time for the user and designer as a site becomes more and more complex.
Ignoring the painful process of choosing which modules to use, the current methodology for creating a site is:
Of course, the site map or site plan usually needs to be constrained, or at least have consideration for what is possible. This used to be simple. Most people building Drupal sites were technical. At first it was easy to build a site plan because "nodes" were the lingua franca of site design in Drupal. Even when the CCK came along, it was still a matter of segregating the site into nodes of different types. Blocks and menus were adornment and utilities, but still manageable in the mind of the site designer. Non-technical site designers could even grok this world of "components".
Then came views. Panels. Advanced theming with extensive control of page templates. Add module after module which attempts to add richness and flexibility to the way each page can be designed. The non-technical site designer now is completely at a loss to determine "what can Drupal do?" And this is not good, as larger site design teams contain specialists in design, IA, user experience, content, and software. Bridging the gap between technical internals and site design terminology is why so many CMS systems resort to "fixed models" using literally created sitemaps like Silverstripe or the notion of channels like Vignette. While these are limiting in some ways, they establish a technical framework that is conceptual so that design concepts can be directly translated into configuration clicks.
So, an alternative methodology might be:
I know this might seem inprecise rather than pinning down specific technical requirements. But, I have some pretty concrete empirical evidence that the concept of context is something that both non-technical and technical people can embrace and use to define the concrete elements of a site. It's a lot better than talking to site designers about nodes, views, blocks, panels, nodequeues, and pathauto and the combinatorial algorithm for what might or might not appear on their pages. For us, the end result has been that our site is easier for the non-technical content managers (we have 3 of them) to understand and change without as much technical assistance and most importantly, the concepts used in the admin UI reflect the concepts that were present in the site plan.
I apologize for taking up as much of your time as I have, and I hope that the thread of discussion at least benefits somebody at some point. I also realize that turning these theories into code is the best way to test them, so will be trying some context alternatives using ctools just to see what happens.
Comment #10
garywiz commentedI just keep coming across examples of people trying to implement generic solutions, usually related to blocks of course:
There are many others that incorporate nodetype and path-based context as part of their functioning, but the above appear to offer context recognition as their primary benefit. Obviously, blocks are the biggest focus since the relationship between blocks and other page content is a major information design issue.
Comment #11
sdboyer commented@garywiz - sorry, I've been NUTS the past week and a half. I'll respond more soon.
Comment #12
EvanDonovan commentedSubscribing. This is an interesting discussion.
Comment #13
frankcarey commentedyes, interesting. I've written (and just upgraded to panels 3) a location_context plugin for panels that that allows for location module location contexts (just country for now) in panels. I also just started a context_rules module to allow you to set context module contexts based on rule conditions, so I'm familiar with both APIs. I'm seeing definite room for cross pollination here. For instance:
1) Ctools could expose it's contexts to the context module, so that the context_ui module could control blocks and regions using ctools logic
2) Context module could provide "ctools context" hooks so that you could set page variants based on context module contexts.
Thoughts?
Comment #14
frankcarey commentedAlso I think it's interesting to note the context module's description in the modules page. "Provide modules with a cache that lasts for a single page request." Kind of an odd description, but it gets to the heart of what's happening in the context module. At it's core, you basically are setting and getting triplets in memory, where the triplets are namespace, attribute, and value. If panels were to integrate, it could simply set something like this when viewing a user override page for the admin user:
Namespace: ctools_user
Attribute: uid
Value: 1
It could even set multiple context triplets as needed...
Namespace: ctools_user
Attribute: is_self
Value: FALSE
Comment #15
merlinofchaos commentedFrank: I would consider patches that are low impact.
Comment #16
colorado commentedThis was a really interesting and helpful discussion. Thank you to the participants.
Comment #17
NKaush commentedgarywiz, I cant help but appreciate your point. Being a non-technical newbie myself, I just seem to be going in circles around panels, blocks, themes, node heirarchy, node relativity, node reference etc for the past two weeks in trying to get output on a "page". I havent even looked at books, menus, ogs etc yet as I'm already overwhelmed at this point.
Comment #18
davidburnssubscribe
Comment #19
lpalgarvio commentedsubscribing as well
see butler project:
http://drupal.org/project/butler
and context/butler group:
http://groups.drupal.org/wscci
context and butler:
layout and butler:
http://www.garfieldtech.com/blog/web-services-initiative
Comment #20
lpalgarvio commentedContext OR Butler module integration:
http://drupal.org/node/1211388
Rules module integration:
http://drupal.org/node/1211368