I have a Content-type 'Reports' containing a field called 'Country' which has allowed values listed in the form:

1|England
2|Wales
3|Ireland

The field is an integer list so that I can use the 'Multiple Values' option in the View that displays this Content Type (see below)

The View has filters for Published=Yes and Content-type=Reports. It also has a Contextual Filter (Argument) for Content:Country. Visitors on, say the England page have a link to the View which includes /1 at the end of the URL. Likewise, the link on the Wales page includes /2 at the end of the URL etc etc.

The setup for the Contextual Filter has the box ticked for 'Override Title' and the following in the box for the replacement Title:
Reports from %1

The View works correctly and displays the correct Reports, but the Title is displayed as 'Reports from 1'. instead of 'Reports from England'. In other words, it is displaying the Key instead of the Label.

This works correctly in Views 6.x-3.0 which is why I am assuming it is a bug in 7.x-3.3

Footnote:
My Contextual Filter has 'Allow multiple values' ticked so I can use the View to list reports from a selection of countries e.g to display Reports from England and Wales the URL ends with /1+2. This will only work if the key is an integer. Again, the View works correctly and displays the correct Reports but the Title says 'Reports from 1+2' instead of 'Reports from England+Wales.

Comments

You can name it either bug of missing feature but yes that's missing in views.

If someone would like to fix it, you would have to extend the existing handler classes to use the allowed values in the title() method.

StatusFileSize
new790 bytes

Hi guys, this patch worked for me, hope it helps you as well. This is the code:

<?php
 
function title_query() {
   
$titles = array();
    foreach (
$this->value as $value) {
      if (
array_key_exists($value, $this->allowed_values) && !empty($this->options['summary']['human'])) {
       
$titles[] = check_plain($this->allowed_values[$value]);
      }
      else {
       
$titles[] = check_plain(value);
      }
    }
    return
$titles;
  }
?>

There is still another small "issue", the human option value can only be set under When the filter value is NOT in the URL when you click on the "display summary" option, the value is still available for any other option you used, though, at least for the ones I tried.
On another note I think this it should be set as a global option.

StatusFileSize
new791 bytes

Small correction:

<?php
$titles
[] = check_plain(value);
?>

to:
<?php
$titles
[] = check_plain($value);
?>

will this patch be committed to the module? I'll apply it to my site but I hope it won't get lost if I update in the future... This does truly seem to be a bug to me and it took me a while to find this..

There is still another small "issue", the human option value can only be set under When the filter value is NOT in the URL when you click on the "display summary" option, the value is still available for any other option you used, though, at least for the ones I tried.
On another note I think this it should be set as a global option.

I totally agree.. It took me a while to find that option after looking at your code. This should absolutely be a global option, or at least added under the "Override title" checkbox as a sub-option there.

I absolutely agree with #2 and #5. I have contextual filters using both regular taxonomy and entity reference so I need this option under "WHEN THE FILTER VALUE IS AVAILABLE OR A DEFAULT IS PROVIDED" as well...

Same problem as #6. I'm working on a site that was upgraded from D6, where this worked (way back in Views 6.x-2.12!) So it seems like a big regression that now I have "Providers in 7" instead of "Providers in Pediatrics." Now I'm trying to figure out a hacky way to hard-code the titles in the absence of a fix ...

Version:7.x-3.3» 7.x-3.x-dev

Status:Active» Needs work

I wish I had the chops to fix this. Totally agree with #6 that this would be a great option in the "Override title" as well as "Override breadcrumb" boxes.

Also contextual filters are using keys only. It would be fine to use both(key and description) OR to decide on contextual filters tab to use key or description.

For example:
/1 -> works, but title is 1
/England -> doesnt work, should output same like /1 but with title England

This came up for me because custom breadcrumbs using tokens outputs the decription (here "England") and not the key that is needed to display the view. (I ended up editing all keys to be the same like the description. But if there are changes i need to create a new key and reassign all elements to the new one.)

So I saw a similar issue to this here but it was about taxonomy terms. However I updated the code to reflect my own use.

I was having a similar problem as #6, #7, #10, although instead of node references I was handling product references from Drupal Commerce. Here's the hook I placed in my template.php:

<?php
function [THEME_NAME]_preprocess_views_view_summary(&$vars) {
    if(
$vars['view']->name == 'article_archive' && $vars['view']->current_display == 'block_1') {
       
$items = array();
        foreach(
$vars['rows'] as $result){
            if(
is_numeric($result->link)) {
               
$product = commerce_product_load($result->link);
               
$result->link = $product->title;
               
$items[] = $result;
            }
            else {
           
//used for the <no-value> item
               
$items[] = $result;
            }
        }
       
$vars['rows'] = $items;
    }
}
?>

For node references you would use node_load instead of commerce_product_load, and I think you stick to title as the property you're trying to replace in the result list.

Hope this helps!

i also had this problem. the fix for me is, in contextual filter, use [field_yourfieldname] instead of %1. hope this helps