In the default Calendar view (calendar module), a filter is one of nodetypes: array('article', 'page') is set.
In a standard Drupal installation this results in an admin summary "Node: Type in article, page".

However, if one of the nodetypes or both don't exist in the Drupal installation, the admin summary is expected to reflect that. Instead it shows "Node: Type in article," (expected: "Node: Type = article") or "Node: Type in , page" (expected: "Node: Type = page") or just "Node: Type in" (expected: "Node: Type = Unknown"). Only after manually reconfiguring the filter the status is reflected.

This is surely not wanted. In views_handler_filter_in_operator::admin_summary(), it is checked only for single options if they are applicable. For multiple options this is taken for granted.

Enclosed is a patch that fixes this and makes sure, that in any case only valid options are displayed. I needed to rewrite the whole function - the result is not a single line longer and quite as efficient as it was.
The patch has been tested by myself, but should probably get some more testing.

Comments

merlinofchaos’s picture

Wow, on the list of patches that fell through the cracks. Sorry. Can I get a reroll? This doesn't apply, and it looks valuable.

merlinofchaos’s picture

Status: Needs review » Needs work
dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new1.53 KB

This patch is a total different approach to the problem.

It scannes first to every value and looks whether the value is still valid. Then choose different output for 0, single, multiple values

I used this tree views to test... They could be used for a simpletest

$view = new view;
$view->name = 'operator_view1';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Filter: Node: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'story' => 'story',
);
$view = new view;
$view->name = 'operator_view2';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Filter: Node: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'story' => 'story',
  'page' => 'page',
);
$view = new view;
$view->name = 'operator_view3';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Filter: Node: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
  'foo' => 'foo',
  'bar' => 'bar',
);
merlinofchaos’s picture

Status: Needs review » Fixed

Committed to all branches.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.