View source  
  <?php
class views_filterfield extends views_handler_field {
  function option_definition() {
    $options = parent::option_definition();
    $options['views_filterfield_field'] = array(
      'default' => FALSE,
    );
    $options['views_filterfield_separator'] = array(
      'default' => '+',
    );
    $options['views_filterfield_case'] = array(
      'default' => 0,
    );
    $options['views_filterfield_transform_dash'] = array(
      'default' => 0,
    );
    return $options;
  }
  function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);
    $filters = $this
      ->get_filter();
    foreach ($filters as $filter => $handler) {
      $title = empty($handler->options['ui_name']) ? t('@group: @title', array(
        '@group' => $handler->definition['group'],
        '@title' => $handler->definition['title'],
      )) : $handler->options['ui_name'];
      $options[$filter] = check_plain($title);
    }
    $form['views_filterfield_field'] = array(
      '#type' => 'select',
      '#title' => t('Filter'),
      '#description' => t('Select the filter whose value you want to display.'),
      '#options' => $options,
      '#default_value' => $this->options['views_filterfield_field'],
      '#required' => TRUE,
    );
    $form['views_filterfield_separator'] = array(
      '#type' => 'radios',
      '#title' => t('Multiple value display'),
      '#description' => t('How should multiple values be displayed? This can affect how a value is passed to an embedded view.'),
      '#options' => array(
        '+' => t('1+2+3 (for OR)'),
        ',' => t('1,2,3 (for AND)'),
      ),
      '#default_value' => $this->options['views_filterfield_separator'],
      '#required' => TRUE,
    );
    
    $form['views_filterfield_case'] = array(
      '#type' => 'radios',
      '#title' => t('Text case'),
      '#description' => t('Do you want to change the text case of the generated filter string?'),
      '#options' => array(
        0 => t('No transform'),
        3 => t('Upper case'),
        1 => t('Lower case'),
        4 => t('Capitalize first letter'),
        2 => t('Capitalize each word'),
      ),
      '#default_value' => $this->options['views_filterfield_case'],
      '#required' => TRUE,
    );
    $form['views_filterfield_transform_dash'] = array(
      '#type' => 'checkbox',
      '#title' => t('Transform spaces to dashes'),
      '#value' => 1,
      '#default_value' => $this->options['views_filterfield_transform_dash'],
      '#required' => FALSE,
    );
  }
  
  function query() {
    $this->field_alias = 'views_filterfield_' . $this->position;
  }
  
  function render($values) {
    $output = array(
      'all',
    );
    $filter = $this
      ->get_filter($this->options['views_filterfield_field']);
    if (!empty($this->view->exposed_input[$filter['expose']['identifier']])) {
      if (is_array($this->view->exposed_input[$filter['expose']['identifier']])) {
        $output = $this->view->exposed_input[$filter['expose']['identifier']];
      }
      else {
        
        $output = array(
          $this->view->exposed_input[$filter['expose']['identifier']],
        );
      }
    }
    
    if (!empty($options['views_filterfield_transform_dash'])) {
      array_walk($output, create_function('&$val', '$val = strtr($val, array(" " => "-"));'));
    }
    
    switch ($this->options['views_filterfield_case']) {
      case 1:
        
        array_walk($output, create_function('&$val', '$val = drupal_strtolower($val);'));
        break;
      case 2:
        
        array_walk($output, create_function('&$val', '$val = ucwords($val);'));
        break;
      case 3:
        
        array_walk($output, create_function('&$val', '$val = drupal_strtoupper($val);'));
        break;
      case 4:
        
        array_walk($output, create_function('&$val', '$val = drupal_ucfirst($val);'));
        break;
    }
    
    $separator = $this->options['views_filterfield_separator'];
    $output = implode($separator, $output);
    
    return filter_xss($output);
  }
  
  function get_filter($filter = NULL) {
    $filters =& drupal_static(__FUNCTION__);
    if (!isset($filters[$filter]) || empty($filters)) {
      $filters = $this->view->display_handler
        ->get_option('filters');
    }
    return !empty($filter) ? $filters[$filter] : $filters;
  }
}