Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 292149

Allow contextual filters to optionally include results with NULL values for the specified field (as well as matches)

$
0
0

Problem/Motivation

Drupal 8 version of a Drupal 7 issue.

Original use-case:

Basically, the use case I have is a multivalued field along the lines of "Intended for users of type X", attached to a node. I want to pass in the user's type as a contextual filter, and have the view return nodes that are intended for that type of user. However, if the content editors did not choose anything for the "Intended for users of type X" field on a particular node, that means it's intended for all types of users on the site, so I want the view to show that node too.

My particular use-case is for news items which may or may not be tagged with a "region code" (the codes are specific to my organisation). Where an item is NOT tagged it's considered "universal", and so we want it to be displayed against all codes. Our contextual filter is populated via a URL path component.

Proposed resolution

Patch incoming which naively adapts the D7 patch in the linked issue. (Works for me, but not robustly tested.)

Remaining tasks

Manual testing in #7 confirms the patch in #6 works.
Remove coding standard changes from the patch in #6
Write a Test
Add before and after screenshots to the Issue Summary

User interface changes

Add a mechanism for specifying "matches or is null" on contextual filters

API changes

N/A

Data model changes

Adds storage for a views_argument.include_null boolean value.

Release notes snippet

Adds a mechanism for specifying "matches or is null" on contextual filters


Viewing all articles
Browse latest Browse all 292149

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>