Get the current path in Views
Thanks a lot. I did go down the Views PHP route initially, but it struck me as a bit un-Drupally, and even Views PHP says to use handlers where possible.

In the end I used hook_views_data and did:

function mymodule_views_views_data() {
  $data['views']['current_path'] = array(
    'title' =&gt; t('Current Path'),
    'help' =&gt; t('Provide current path.'),
    'field' =&gt; array(
      'handler' =&gt; 'concept2_views_handler_field_current_path',
    ),
  );
  return $data;
}

/**
 * Implementation of hook_views_handlers() to register all of the basic handlers
 * views uses.
 */
function mymodule_views_views_handlers() {
  return array(
    'info' =&gt; array(
      'path' =&gt; drupal_get_path('module', 'mymodule') . '/handlers',
    ),
    'handlers' =&gt; array(
      // The name of my handler
      'mymodule_views_handler_field_current_path' =&gt; array(
        // The name of the handler we are extending.
        'parent' =&gt; 'views_handler_field',
      ),
    ),
  );
}


With a handler file like:

/**
 * A handler to provide a field that is completely custom by the administrator.
 *
 * @ingroup views_field_handlers
 */
class mymodule_views_handler_field_current_path extends views_handler_field {
  function query() {
    // do nothing -- to override the parent query.
  }

  function option_definition() {
    $options = parent::option_definition();

    // Override the alter text option to always alter the text.
    $options['alter']['contains']['alter_text'] = array('default' =&gt; TRUE, 'bool' =&gt; TRUE);
    $options['hide_alter_empty'] = array('default' =&gt; FALSE, 'bool' =&gt; TRUE);
    return $options;
  }

  function options_form(&amp;$form, &amp;$form_state) {
    parent::options_form($form, $form_state);
    unset($form['help']);
  }

  function render($values) {
    // Return the text, so the code never thinks the value is empty.
    return drupal_get_path_alias();
  }
}