CCK Weak Reference


I had a need to get some sort of fuzzy node referencing going for a project I'm working on and though there are plenty of options in drupal. I couldn't get any of them to do what I wanted.

 

Here's the use case.... Say you are putting together a show calendar. So you create a show content type with a venue field some band fields and all the other stuff that could be handy information to have about a show. Ideally the user can just enter the names and the site would just know what the venue is or who the bands are. Sort of like the autocomplete ajax field thingy used for free-tagging. But if the site doesn't know, it still allows you to enter it and save the information. Perhaps an admin would come in later and Add the venue page and the band page for each show, so over time you'll have this venues directory which will be handy for booking a show and such, and a nice bands directory that could be used in other ways.

So I created a band content type and a venue content type. All the nodereference options I could find in drupals long list of modules either required that the node already exists, or were specific to a given problem domain(Airport codes), or didn't work as advertised in drupal 5, (subform entering etc...which really screws up the workflow more so than what I think any user is willing to go through who just wants to get their show into the calendar) .

 

So I created this thing I call CCK Weak Reference, it basically is an cck ajax field that you can setup to filter to a specific content type for name resolution(node title). But allows entering of anything. At node render time, will display as static text or a link if there is a node to link to.

 

The drawback is that node titles are not enforced to be unique so it will pick the first one everytime which may not be what you want but meh....works for me.

 

So if you think it may be useful for you. then give it a try. But I'm not planning on enhancing it unless the project I am using it for warrants it. You can ask me questions about though if you want.

For drupal 5.x

 

CCK Weak Reference

AttachmentSize
cck_weakreference.tar.gz4.12 KB