View arguments based on tokens are now passing empty strings to view

Created on 29 January 2021, over 3 years ago
Updated 18 September 2023, 9 months ago

Problem/Motivation

We have a view block assigned to an extra field on the edit form for an entity. This view has a contextual filter. The value for that filter comes from at token placed in the extra field manage page. In the box labeled 'arguments' I enter [node:field_somefield:target_id] as the token. Since a recent update to the token module (I think) there is now an '' empty string being provided to my view by the extra field module on the NODE ADD form, since the node doesn't yet have an actual target_id to return. I think before there used to be a NULL returned by the token on a node add form. (This may also have come from views module now treating empty string as an argument and not just treating it as a 'not provided' argument. I am not sure)

Proposed resolution

I think either this module or the views module should ignore the empty string and treat it as NULL. This would allow the view to use the 'default value when argument not provided' part of the contextual filter config in those situations. Any thoughts on whether this should be a view issue or an extra field issue, or any other possible solution ideas. I want the view to use the 'When the filter value is NOT available' section to pull this value from the url in these cases on the 'node add' form.

Maybe a checkbox to refrain from passing empty strings to the view at all.

πŸ› Bug report
Status

Fixed

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States DustinYoder

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024