Pageroute and Nodereference

surge_martin - March 26, 2008 - 20:49
Project:Pageroute
Version:5.x-1.0
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Nodefamily didn't address how I wanted to manage node relationships (between specific nodes instead among all nodes of specified types), so I adapted code from pageroute_pages.inc to allow pages that specifically use nodes referenced to the parent node via a nodereference field.

This is a first draft, so there may still be bugs, especially for cases where cck has stored the field data in a table with the rest of the content data, as opposed to within a specialized table (as it was in the setup I was testing with), though I did try to allow for both cases.

In particular, I was able to get the nodereference field in the child form to show the parent node selected, but my preference would be to convert this into a form value instead, so that it can't be tampered with. If anyone out there has a suggestion for how to do this, I'd appreciate it. I tried some kind of hook_form_alter implementation, but couldn't figure out how to select it properly.

Also, one of the content types I'd like to work with is a webform. I can get it to create the webform OK, but I can't figure out a way to then proceed to a step where the user can start to specify components. I'm guessing it's because that's defined as a local menu item, so you'd need to be editing the webform directly. Again, if someone has a suggestion on how to make it work, it would be greatly appreciated.

Finally, I should mention that this version assumes that the nodereference field is named the same as the parent content type.

AttachmentSize
pageroute_nodereference.zip6.76 KB

#1

surge_martin - March 27, 2008 - 00:45

Whoops, typo in the install file of that last set. This one should work better.

AttachmentSize
pageroute_nodereference.zip 6.76 KB

#2

surge_martin - April 7, 2008 - 19:39

This new version includes some bugfixes, and the parent reference is now successfully passed as a hidden field. I know I could probably just as easily pass it as a variable at that point, but for debugging purposes I thought it was useful to be able to see the value in the page source.

One other little nicety was to include the name of the parent node in the title of the pages for child elements, which help make it more intuitive.

AttachmentSize
pageroute_nodereference.zip 7.13 KB
 
 

Drupal is a registered trademark of Dries Buytaert.