Tuesday, September 19, 2006

Drupal: Show Me, Don't Tell Me

A lot of Drupal functions are swell. A couple are peculiar. Rather than trying to re-invent the wheel, I've wanted to lean on existing Drupal functionality. So, I turned back to trying to make the Content Construction Kit (cck -- http://drupal.org/project/cck ) work for our project. The best hope was using the node reference field type. The good side: it can reference other content types. The bad side: all it did was link to the other content types. This is a classic case of telling when you should be showing. Classic example: you can node reference the image content type. That means you end up with a bunch of links where you want images. I changed it so that the node is exposed instead of a link:

So, I swapped this line in nodereference.module (ca. line 90) from this:
return l($referenced_node->title, 'node/'. $referenced_node->nid);

to this:
return (node_view($referenced_node));

This means that the referenced content is included. The downside: all of the referenced content is included. I did some work today on a new field type: "node inclusion" that will allow the inclusion. In the changing face of Drupal, there is a new field called the Compute Field (
http://drupal.org/project/computed_field ). It is too soon to say what potential this has, but it make help by allowing us to build a link (for instance) out of the link fields.