3

The task

My goal is to split the node edit page with the main field forms staying on the default one (the add page itself or mynodeurl/edit), and some additional field forms on the other pages (e.g. mynodeurl/option & mynodeurl/otheroption).

I think the best way to do this (and the way I want it to work) would be using a couple of variants for the node add/edit page (Panels Module), with the url path's being filtered through the string: url path selection rules.

The problem

I have no idea how to make the string url path selection rule work like that (I practically dont know anything how the string url path's selection rules work for the node (or node add\edit pages) at all, since I've only seen people implementing the url path based selection rules on custom pages and never on nodes).

How I've tried to solve it

I've done some playing around setting url path's like: /option option /option nodetype//option etc. to the node template and the node add\edit form variants, the only thing that worked is when i set my main node view variant to trigger when: Current path is not "/option" , and set the additional variant to trigger when Current path is "/option", the exactly same thing didnt work for the node add\edit page. (see http://shot.faintrush.me/xfvu1c0aic.png <- this screenshot).

The only working variant is using the Node template page, and adding forms there doesn't work which makes it useless for me. (If you know how to make forms work on the Node template page you'r also very welcome to answer here).

Of course the */option is probably not the best thing to put there, it's just the only one I found that's at least a bit alive.

Additional info

By default my url's work as I have explained here -> https://drupal.org/node/1993068 (i made those url aliases being created automatically but in a different way from using a pathauto + a custom token) To make the links like siteurl.com/nodetype/25/edit work i use the sub-pathauto module (i have tried setting the sub-pathauto url depth to 2 and accessing siteurl.com/nodetype/25/edit/option with the settings on the screenshot above - didn't work).

More additional info

I also tried to make this work by creating a custom Page with the /node/%node/option path and assigning %node the Node edit form: node ID context, but then I'm running into another problem because the Node id doesn't actually match the url path and there's no way for me to assign the right context to the node edit form - the unique content type node id that i'm using in urls (again, read the issue from the link a bit higher) is not to get by any token or variable, the url alias is just being generated once by the rules module.

I posted the same issue (written in a little bit different words) to the drupal official website issue queue to the panels module but there seems to be no activity there for a couple of days so I'll give it a try here.

Any help would be appreciated!

9
  • While I can sort of see how it would work, I don't think using multiple variants is a good idea. You're looking to break down a form into multiple steps, I don't see a good reason to tie that implementation to page manager. I would instead look for a generic single-to-multi-page-form-solution that would nicely "Just work" inside a single variant.
    – Letharion
    Aug 22, 2013 at 10:57
  • || I would instead look for a generic single-to-multi-page-form-solution that would nicely "Just work" inside a single variant. || Could you please go a little bit more detailed here? And I'm not sure if you understood that but in my situation the addtional form pages are to be edited ONLY after the node is published with the default form (not just step by step: edited first forms page -> edited second forms page -> published), and it also SHOULD have a specific URL
    – slavatar
    Aug 22, 2013 at 11:05
  • Maybe I don't understand. Your title says "Split the node edit form into multiple pages". I don't follow why my suggestion is not applicable to doing that. If you want to redirect the user to some specific page afterwards, you could do that. Maybe, when you say "Form", you don't mean that in the strict "A Form API form" sense, but in a "A collection of input fields" sense?
    – Letharion
    Aug 22, 2013 at 11:47
  • "I posted the same issue ... to the ... issue queue to the panels module but there seems to be no activity there" Yeah, I know. Every time I look at the queue I get annoyed that the documentation is so sparse, but I also don't want to take the time writing it.
    – Letharion
    Aug 22, 2013 at 11:48
  • You'r right, i do mean "a collection of input fields" by a "form", and I didn't necessarily mean that your suggestions aren't applicable, I just don't understand them. You told me to look for a "single-to-multi-page-form-solution" which at my current level of drupal knowledge doesn't tell me much (in a way of how to actually do it). Using panel variants on the other hand I have a clear image in my head how am i going to make it work the right way, the only thing I'm missing are the correct "string: url-path" selection rules, which I believe SHOULD exist.
    – slavatar
    Aug 22, 2013 at 12:41

4 Answers 4

1

Please have a look at Multistep Nodeform.

enter image description here

For each step you can define which fields should be included in this step. "Fields" includes core-fields like "Title", "Body" or "Authoring information" as well as fields defined by other modules (e.g. Date).

0

I don't fully understand the question, but there's a lot to cover, so here are some bits and pieces, and hopefully we can iron out something better from it.

For what it's worth, you refer to Panels, but it's Page manager that the question revolves around.

I'm running into another problem because the Node id doesn't actually match the url path and there's no way for me to assign the right context to the node edit form

If you've come up with your own identifier scheme for you nodes, Page manager doesn't know about it. You can tell it, but implementing a new context type. See What are Ctools plugin (content type, access, etc), and how does one create them?.

If you know how to make forms work on the Node template page you'r also very welcome to answer here

On node/%/edit, the edit form context is implicit, on node/% you can go to relationships and manually explicitly add it, but I don't see how that helps you. Plus using the node view to do node edit in general is weird.

4
  • || On node/%/edit, the edit form context is implicit, on node/% you can go to relationships and manually explicitly add it - that was the solution I mentioned 2 hours ago: adding a Node edit form from node relationship to a node/% template page panel. Yes, this way is kinda weird but in my current situation it does quite good. Creating a custom context type might also work but would require more time and more drupal knowledge that I've got. So, generally the thing I was looking for was quite simple, I just never really paid attention to the "Relatioships" tab in contexts.
    – slavatar
    Aug 22, 2013 at 16:36
  • I would still like to know if it is possible to split the node add\edit page panel into different multiple pages using variants filtered by the string: url-path selection rules. Thank you for your help efforts though!
    – slavatar
    Aug 22, 2013 at 16:39
  • Actually.. lol, it is possible, and it is quite simple. Just instead of using the "String: url path" path selection rules I could implement a PHP code based selection rule and make some simple parsing of the current_path() drupal function inside there.
    – slavatar
    Aug 22, 2013 at 16:42
  • You're obviously free to use it, but PLEASE do yourself a favor and look at creating a new access plugin instead, which will do that for you, see link above. Use of the PHP filter should be BANNED.
    – Letharion
    Aug 22, 2013 at 17:05
0

The Field Group module can split the node edit form into horizontal tabs for example, under each one of them you can select which fields to show.

Here: https://www.drupal.org/project/field_group

0

When you are testing the url, it tests the original path. So if your node/15 has an alias of match/christmas and you want to make the match/christmas/options use another panel, you can add a 'PHP code selection rule' to your panel. The way I've managed whas to print the args with dpm():

dpm(arg(0)); // node
dpm(arg(1)); // the node id, ex: 15
dpm(arg(2)); // options

Them I updated the code to:

if (arg(0) == 'node' && arg(1) == 'options') {
    return TRUE;
}
else {
    return FALSE;
}

And it worked =D

BUT putting php code isn't the best practice. SO I created a new "string URL path" selection rule with the path that now I know for sure that its being used.

node/*/options

Hope this helps =)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.