I have a page view set up with multiple contextual filters. The last filter is a "Global: Null" I have set up to block unneeded arguments. This should catch all nonexistent pages and display "Page Not Found" and works in all cases except when the final argument is 'all':

  • /arg1/arg2/invalid-page shows Page Not Found
  • /arg1/arg2/all shows all results for /arg1/arg2

This seems to be the behavior specified when the "Exceptions" field contains "all". I can solve this in other filters by clearing the "Exceptions" field of all text, but the Global: Null filter does not contain an Exceptions section. See attached screenshot.


Full contextual filter options for Global: Null:

When the filter value is not in the URL:
Display all results for the specified field

When the filter value is in the URL or a default value is provided:
Specify validation criteria:
Validator: - Basic validation
Action: Show "Page not found"

More:
Fail basic validation if any argument is given

Comments

markosef’s picture

Not the same problem but I did "show page not found" for the "When the filter value is not in the URL:" and this removes it at least from breadcrumbs, but it is still in the system.

markosef’s picture

Issue summary: View changes

Fixed path examples

nikolay shapovalov’s picture

Issue summary: View changes

Okay, I have the same issue. Is there any solution?

nikolay shapovalov’s picture

Okay, i just comment line 34 in file handlers/views_handler_argument_null.inc

    // unset($form['exception']);

Than i see the form with exceptions, there was "all".
I remove it, than saved, and all works fine.
I think it's due to default value.

nikolay shapovalov’s picture

Version: 7.x-3.6 » 7.x-3.x-dev
Status: Active » Needs review
StatusFileSize
new758 bytes
new109.32 KB

This is working patch.
1.Apply patch.
2. then remove current Global:null argument.
3. create new one Global:null
4. Configure it like on screenshot
null configuration
and it should works.

nikolay shapovalov’s picture

StatusFileSize
new617 bytes

This is the same patch but with less code.
Test this patch using instructions from comment #4

nikolay shapovalov’s picture

nikolay shapovalov’s picture

Priority: Normal » Critical
nikolay shapovalov’s picture

Version: 7.x-3.x-dev » 7.x-3.8
nikolay shapovalov’s picture

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

Why does nobody test my patch?
This is issue is still working in 7.x-.3.8.

mustanggb’s picture

Priority: Critical » Normal
chris matthews’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

The 5 year old patch in #5 to views_handler_argument_null.inc does not apply to the latest views 7.x-3.x-dev.

Checking patch handlers/views_handler_argument_null.inc...
error: while searching for:
  function option_definition() {
    $options = parent::option_definition();
    $options['must_not_be'] = array('default' => FALSE, 'bool' => TRUE);
    return $options;
  }

error: patch failed: handlers/views_handler_argument_null.inc:14
error: handlers/views_handler_argument_null.inc: patch does not apply
andrew answer’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new624 bytes

Patch rerolled.