If you choose the node: body as filter you can choose "is empty/is not empty" for grouped filter operators.
Sadly the filter require you to input a value even for that.

As the actual filtering happens without the value you can input anything but this is a quite huge UX fail.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dagmar’s picture

Tagging, I'll will try to provide patches for all the issues tagged with 'Hybrid Filters Follow-ups' as soon as possible (probably during September). Please help me tagging those issues.

peterpoe’s picture

Priority: Major » Normal
Status: Active » Needs review
FileSize
898 bytes

Here is a patch for 8.x. I don't see any way to recognize operators that don't require a value, so I just added a check for "empty" and "not empty". There may be a better way to do this.

But maybe requiring that the field is filled is not even necessary?

peterpoe’s picture

Here is the same patch for 7.x.

dawehner’s picture

@peterpoe
If you look at the operators() method you see something like

      '=' => array(
        'title' => t('Is equal to'),
        'short' => t('='),
        'method' => 'op_equal',
        'values' => 1,
      ),

which tells you which operators need what amount of values ... I guess you could use this information?

peterpoe’s picture

dawehner’s picture

Issue tags: +Needs tests

Let's also write a test for test, just to be sure it will not happen anymore in the future.

dawehner’s picture

To be write tests, some additional lines in ExposedFormTest.php would help.

xjm’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 8.x-3.x-dev » 8.x-dev
Component: Code » views.module
Status: Needs review » Needs work
Issue tags: +Needs reroll
dawehner’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
4.04 KB
2.88 KB

Here is a test and the actual fix from above.

mikeker’s picture

Just FYI, that the 7.x version of this patch is in the Views issue queue.

dagmar’s picture

FileSize
4.07 KB

Re-rolled.

dawehner’s picture

Issue tags: -Needs reroll
FileSize
4.1 KB

That one just needed a small adaption.

dawehner’s picture

#12: drupal-1785318-12.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +VDC, +Hybrid Filters Follow-ups

The last submitted patch, drupal-1785318-12.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
4.1 KB

Status: Needs review » Needs work

The last submitted patch, drupal-1785318-15.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review
FileSize
1.17 KB
4.25 KB

The new test assertion was not asserting the correct path, I think we need to append '/default' to it. I also added another assertion to make sure we don't have the validation error text - might come in useful at some point for debugging, you never know!

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Nice!

xjm’s picture

#17: 1785318-17.patch queued for re-testing.

xjm’s picture

Issue tags: +Quick fix
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.x, thanks!

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