Followup to #2010898: Use tokens for entity selection view arguments:
* Use token for entity selection view arguments
* Add a token that sometimes is empty (and is not the last if that matters)
* Have that argument "display all if empty"

This makes views display nothing instead of all items.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

axel.rutz created an issue. See original summary.

geek-merlin’s picture

Status: Active » Needs review
FileSize
1.09 KB

Patch flying in that fixes this issue for me.
It extends the "pass 0" logic for empty entity IDs to all other empty args.
(I'm not too happy with this, but i don't expect the underlying views question will ever be fixed in D7.)
(Quite some people consider anything that views does after such a long time a feature not a bug ;-)

MustangGB’s picture

cmseasy’s picture

Patch worked for me, thanks

joelpittet’s picture

The solution in #2 seems like it needs more thourough debug into the root cause. Setting all the empty values to 0, should be done in views if it's really correct way forward.

david.qdoscc’s picture

For me this patch still didn't address the issue with [node:nid] resulting in an error Notice: Undefined property: stdClass::$nid in node_tokens()

I did get around this by using [current-page:url:unaliased:args:value:N] instead of [node:nid] to pass the ID when editing existing content but pass a 0 when adding new content.

Pancho’s picture

marksmith’s picture

Solution #6 works if (A) entity reference field widget type is (multiple value) select list, but not with (B) ER multiple value autocomplete field (with Add more button). (B) is preferred in some cases where selected value order is important.