I've filed this issue in an attempt to show how context_admin support might fit in here. It has been expressed to me that no additional dependencies will be considered, so all of this code supports the use of context_admin/page_manager without the need for additional modules to make it work.
below are links to two diffs from the free time I gave this topic this evening. These are VERY simplistic examples, and to really leverage the entirety of what ctools could possibly provide to workbench will require a bit more code, but hopefully this gets the juices going and we can discuss further.
http://drupalcode.org/sandbox/eclipsegc/1103634.git/commitdiff/c319095
http://drupalcode.org/sandbox/eclipsegc/1103634.git/commitdiff/2f64e49be...
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | task_plugin-1103638-22.patch | 9.93 KB | stevector |
| #17 | task_plugin-1103638-17.patch | 9.76 KB | stevector |
| #13 | task_plugin-1103638-13.patch | 9.76 KB | stevector |
Comments
Comment #1
agentrickardThe patches are fairly clear, but what does this do in practice?
Comment #2
eclipsegc commentedEssentially we've moved all code specific to these two components (workbench_content and workbench_create) and we've fully encapsulated everything those items need in order to be called in a standalone manner by context admin. This means that if I wanted to generate my own custom "workbench" and I wanted to utilize these portions of what workbench module does, I could reuse them from the UI w/o needing to dig into code.
We've then provided our own simple rendering utility for context_admin plugins. This could probably be updated to work for ctools content_type plugins as well, at which point I would advocate moving away from the views page_display and having hardcoded menu items for your views where the view that is used is a content_pane display. This makes all your views reusable for anyone wanting to mash them up in their own panels. I guess that would add a "views_content" dependency so perhaps you're -- to that... hmmm well, I think you probably get where I'm going at this point. The bottom line is you have a lot of really awesome stuff here that with a little work could be very reusable for people outside of workbench. I'd personally like to see workbench NOT deploy menu items for the sake of sanity, but I realize I will probably not be able to convince anyone of that in the near term, so the complete goal here is to provide reusable components.
Comment #3
stevectorI have not tried out these patches yet but I like the idea of breaking Workbench into more flexible chunks. Would a change in this direction make managing overrides easier? See #1109672: Allow exports of overridden to Views
Comment #4
eclipsegc commented@stevector
Exactly, if a view doesn't take a path, and instead relies upon page_manager to place it, page_manager allows for additional variants to be added to a page. As such you can clone the view in question, change as desired, and set up a variant that displays your view instead of the default. Typically this is done with selection rules on the variant and once you understand page_manager is quite trivial to both setup and export (since you're exporting JUST the variant and not the entire page's settings). The best way to do this is to actually provide a "task" plugin for the path in question. I intend on demoing that eventually but hadn't really tried to make it that far yet.
Eclipse
Comment #5
stevectorThanks for the explanation Eclipse. I'm still trying to wrap my head around all the ways we can CTools-ify Workbench and what the pros and cons are of doing so. I know one trade-off other Workbench maintainers will want to keep in mind is flexibility vs. ease off use upon initial install. We want site builders to install Workbench and start using it to improve how there users interact with content. Before launching the Beta we looked for ways to cut the amount of time Workbench had to be configured before Workbench could be used to configure nodes.
So I think the question is whether the increase in flexibility worth an increase in learning curve. I think the answer is yes, the flexibility is probably worth it. Would you consider your patch a "proof of concept" and to really make this change a lot more work has to be done?
Also can you comment on the stability of CTools in Drupal 7? I anticipate a healthy amount of hesitancy to increase the ways in which Workbench depends on an Alpha module. What are the risk there?
Comment #6
stevectorEclipse, there's a related issue about extending Workbench Moderation (possibly with CTools) that could use the input of someone with more expertise. Can you look at it an comment on where there might be overlap with the concerns here?
#1108502: Allow modules to alter the list of possible next states
Comment #7
eclipsegc commentedStevector,
So... there are various things at play here, so I'll try to be as concise as possible w/o assuming you know ctools/page_manager too much.
There's an obvious hesitancy to add new dependencies to workbench, I respect this, but the degree to which you can embrace available tools w/o increasing your install overhead is something you'll have to balance I will just try to make the arguments for new dependencies. Specifically 2, which you already have available because ctools is present. Page_manager and Views_content. I WANT to see a page_manager dependency, but I don't view this as absolutely necessary. I think you NEED a views_content dependency for the availability of additional views display types (view panes specifically). This is at first sort of a "wtf?" because view panes display in panels, but we can write a custom handler for displaying these at our own custom paths (see how I did this with context_admin plugins w/o the need for a context_admin dependency in the commits I've sited here). This means people who install panels get the benefit of your views in a panels native format w/o you needing a panels/page_manager dependency.
That being said, I mentioned moving to explicit paths instead of views doing that work. This allows us to write a task plugin for page_manager. When page_manager is enabled, the task tells page_manager how to override your custom paths, this does not make you dependent, just gives your users additional flexibility for workbench defined paths. i.e. if they want to change the output of a given path under certain conditions, they'd have that ability. (say cloning one of your base views, changing it and displaying that instead of your packaged view for some particular role). These sorts of settings would also be exportable so they could "featurize" workbench alterations w/o needing to hack workbench at all.
Bottom line, the setup work your end users do is no greater than it currently is (because you've custom defined all your menu paths and what appears on them), there is one additional module dependency (views_content), and one suggestion (page_manager) both of which are in ctools, so... and you allow your users to leverage the whole ctools stack for your tools if they so desire, and if not, they remain blissfully ignorant.
In so far as what I've written, it's definitely a proof-of-concept in that, we'll want to expand what the basic page callback I've written thus far can do so that it CAN leverage a ctools context stack (in case you start passing user contexts, or node contexts, or something else in the future). As it is, it's probably sufficient for your current needs, but the leg work to get it complete is probably not that extensive. I think I have an example of code that is closer to "complete" sitting around somewhere. I just need to go find it.
Hopefully this answers your questions?
Eclipse
Comment #8
stevectorEclipse and I chatted in IRC today. Just wanted to summarize here as well that I will try out this patch and get a broader understanding of CTools to know how this integration could work.
Comment #9
stevectorHi again,
I tried the patch and think I'm understanding what's going on and how we can leverage CTools. I'll explain my understanding and I hope I'm just rephrasing what you've already written. That'll mean I'm seeing where you want to go.
1. Tasks: Task plugins like node_edit.inc allow CTools' page manager to "take over" pages like "node/%node/edit" using "task handlers" like Contextual Admin, Panels and http response code. Workbench could have a couple task plugins for "admin/workbench", "admin/workbench/create" etc that would allow any task handler (Context Admin, Panels) to override Workbench's default pages. So when site builders say "I like Workbench but I need more stuff and a different layout on admin/workbench" the easy answer could be "override it with Panels because Panels is the standard those types of things." As I understand the architecture, we would not need a Page Manger dependency to put these task plugins into Workbench modules. They would become available if and when Page Manager got enabled. That's a plus.
2. Content plugins and Contextual Admin plugins: Once a site builder has overridden a path like "admin/workbench" they will want all of the elements of that page available as component parts in order to rebuild/restructure/layout the page again. The big idea here is to make sure our code is atomized so we can take something like the content of "admin/workbench/create" and drop it into a content plugin or Contextual Admin plugin. These plugins would then only be calling one function from the Workbench API. In this case "workbench_create()." Again, I like the approach because it does not introduce any dependencies.
3. View Panes: I agree that Views content panes are the easiest way to work with Views inside of Panels, especially when the View takes arguments. They serve the same purpose as the functionality in point 2. What would happen if the Views export code in Workbench contained a Views content pane display variant and the site did not have Views content panes enabled? Would Views handle it somewhat gracefully? That might be a way to leave out a dependency out of our .info file and just strongly recommend using Views content panes. Maybe I'm putting too much concern on introducing a dependency.
What am I missing? In the scenario I describe Workbench would still be using hook_menu() as normal. That might restrict some use cases. For instance if someone didn't like the name "Workbench" and wanted to use" Warroom" they could use Context Admin to make "admin/warroom." However a custom hook_menu_alter would still be needed to turn off admin/workbench.
Also warning to other patch testers, I got some WSODs with workbench.pages.inc trying to get pulled in after the patch had deleted it. Might take some slight hacking to get this running.
Comment #10
eclipsegc commentedStevector:
Points 1 & 2: YES, you have hit the nail on the head completely. Everything you said there was correct.
Point 3: We would have to discuss what views fallback mechanism is for such situations, but I doubt it will be "graceful". ;-) You already have ctools dependency, you're just adding an additional dependency you already have the code base for. I understand that there is some reason you all are gun shy about this, all I can say is "try it see". I think the payoffs are worth whatever perceived downsides there are.
Concerning your "menu_alter" statements, again "YES" this is all true, the only way around that is to utilize a page_manager dependency, forgo the task plugins and utilize page exports. These are able to be turned on/off from the UI. This is actually simpler than going to the trouble of writing task plugins for all your ongoing administrative space needs, but again we're back to the dependency thing. The other point here is that you could end up with panels or context_admin or both as potential dependencies if you went this route. Obviously I have no problems with that, but you all may. Many of us working in this space do full install profiles and make files for every client, so these sorts of dependency trees are trivial and largely "solved" for us. I understand it may not be that way for you all.
With your last post, you've demonstrated that you understand the problem space well, and what I believe to be the potential solutions. I was hoping to collaborate within workbench to solve what I see as an additional, largely unidentified problem space within drupal, and that's this idea I have of menu clustering. i.e. all your content is actually at admin/workbench/... Such a thing could be potentially tokenized and the option of deploying it at /warroom becomes a simple matter of setting a single variable somewhere and telling all the related pages to deploy. Obviously no solution exists here yet, I'm hoping page_manager + some custom code on my part can eventually make this a reality. Workbench was the medium I was hoping to play with that idea in. Obviously that may not be practical directly concerning workbench, but you all have a lot of great stuff sitting here, and deconstructing it to a point that I/we can prove this is a good idea is very appealing to me. I have other code I could use for this purpose, but in that case I have all the same assumptions I always do, and I need to find out of these ideas map against other solutions.
Hopefully that clarifies my interests, and shows where the real obtainable benefits are, and what I hope solutions for tomorrow might look like.
Eclipse
Comment #11
stevectorThat idea of tokenizing paths sound very powerful. I should check out how Organic Groups is dealing with these questions since I know site builders often want to use a word like "team" instead of "group." This type of configuration is the kind I want site builders to do easily.
I'll try to get comments from other WB devs on the big questions here to get a way forward.
I've started on getting non-dependency plugins into the suite over in Workbench Access and will continue on that front as time allows. #1089330-3: Ctools / Views access plugin
Comment #12
Shadlington commentedSubscribing.
Very interested in seeing how this turns out.
Comment #13
stevectorHere's a patch that adds a task plugin and a Page Manager default.
I'm marking this as 'needs work' because I won't commit it until in until I've got documentation written up on the best way to use this. And that will follow this issue #1117364: Advanced Help
Also, I'm not sure if hook_ctools_plugin_api() will allow me to put workbench.pages_default.inc into a sub-directory. I'd rather not have it at the module root.
Regarding some of the bigger issues in this thread, I am taking a conservative approach with this patch. It introduces no dependencies. It does not provide a slick way to tokenize Workbench paths.
It does give Page Manager a way to override admin/workbench so that site builders can change anything they want about the 'My Workbench' page to the extent Page Manager allows. I think this is a big and easy win. Thanks Eclipse for pushing this.
Comment #14
eclipsegc commentedHappy to have helped prod it this far. I'll try to review this at some point and add any thoughts I might have.
Eclipse
Comment #15
BenK commentedSubscribing
Comment #16
tsvenson commentedSubscribing. Really interesting ideas you are discussing for making the Workbench suite both easy get started with, but powerful enough to leverage the features in CTools, Panels, Context Admin and other modules when such functionality will be needed.
I really hope this is something that will be making it into the module suite very soon.
Comment #17
stevectorThis may be ready to go in. Workbench is using Handbook pages instead of focusing on Advanced Help.
Here is a handbook page on how to use this approach. http://drupal.org/node/1226174
Has anyone else tried this yet?
The attached patch is the same as above but made against the latest dev.
Comment #18
stevectorComment #19
itangalo commentedI really really really like this approach. Thanks for implementing it. Re-using the existing Drupal frameworks is a good thing.
Note: Since niether Page manager nor Panels depends on Views content panes, you might end up in a situation where you have overridden My Workbench with Page manager, but you have no Views content panes to display. One way of tackling this is to modify the message displayed in the custom content pane.
Comment #20
stevectorHi Itangalo,
Thanks for reviewing!
I'm not sure if I understand your concern. You can place the Views in panes even if they aren't "Views content panes."
Comment #21
itangalo commented@stevector: Try enabling Page manager and Panels, and then enabling the default template provided by Workbench. If you haven't enabled Views content panes, the views won't show up.
Comment #22
stevectorAh, I see what you mean Itangalo. I've committed the attached patch. It's the same as #17 with the addition of more help text and links to http://drupal.org/node/1226174
http://drupalcode.org/project/workbench.git/commit/9ace4ab8b2c4587c8a30b...