Drupal Views Custom Field module

I recently installed the Drupal Views Custom Field module which allows you to create custom views fields using PHP. There are lots of applications for this. In my case, I wanted to link to either a full node or a URL depending on the contents of the fields of the node. So if the link field is filed out, the title links to that link directly, else the title links to the node. Most of the data you need is an object called $data (go figure).

But one complication was that there’s no way to directly access some of the built-in Drupal functionality. I wanted the path alias which is not directly available. But luckily you can get it from the node path using drupal_get_path_alias() like this:

drupal_get_path_alias('node/'.$data->nid);