In #2010898: Use tokens for entity selection view arguments/#1699378: Allow tokens in entity reference views selection arguments I assumed that this was by design, but comment #94 suggested that this would be better off being handled by views.

axel.rutz:

an empty string should be passed which views should treat as unavailable argument (if not please file an issue about that).

Comments

MustangGB created an issue. See original summary.

mustanggb’s picture

Assigned: mustanggb » Unassigned
Status: Active » Needs review
StatusFileSize
new481 bytes

Testing this out.

mustanggb’s picture

Issue summary: View changes
mustanggb’s picture

After initial testing I've not experienced any adverse effects thus far.

minoroffense’s picture

To avoid warning messages don't we need an "isset() and !empty()" in there? Otherwise if the value key is missing altogether we'll get a different warning, no?

mustanggb’s picture

empty() does not generate a warning if the variable does not exist.

Source: http://php.net/manual/en/function.empty.php

minoroffense’s picture

Right. Duh me.

stupiddingo’s picture

StatusFileSize
new488 bytes

Reroll of #2, line numbers only change.

pancho’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 7.x-3.x-dev » 8.6.x-dev
Component: Code » views.module
Status: Needs review » Needs work
Related issues: +#1699378: Allow tokens in entity reference views selection arguments

Same issue with D8 views, so while technically a separate project, we might want to decide in D8 Core how to proceed, before backporting to D7 Views.

mustanggb’s picture

Project: Drupal core » Views (for Drupal 7)
Version: 8.6.x-dev » 7.x-3.x-dev
Component: views.module » Code
Status: Needs work » Needs review

Please create a new issue for D8.

pancho’s picture

mustanggb’s picture

Parent issue: » #2960871: Plan for Views 7.x-3.23 release
StatusFileSize
new522 bytes

As discovered by Pancho in #3027640: Empty strings ("") passed in as contextual filter argument aren't considered missing "0" is a valid value, so new patch to use the explicit check instead.

damienmckenna’s picture

Status: Needs review » Needs work

Could you please wrap the two conditions in a bracket, to make it more clear, and add a comment explaining the logic? Thanks.

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new594 bytes
new561 bytes

Simplified the code a little.

damienmckenna’s picture

Status: Needs review » Fixed

Committed. Thanks.

Status: Fixed » Closed (fixed)

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