A viewsreference field with no argument supplied is not working when referencing a view block containing a contextual filter that sets 'Provide default value' of 'Content ID from URL'.
In this case, an empty string argument is passed to views_embed_view() in ViewsReferenceFieldFormatter::viewElements() and views is not applying default value handling. Apparently views_embed_view() needs a NULL argument to recognize the filter value is unavailable.
One workaround is to coerce empty string arguments to NULL in ViewsReferenceItem::setValue().
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | viewsreference-empty-argument-2.patch | 745 bytes | keithm |
Comments
Comment #2
keithm commentedComment #3
keithm commentedRerolled patch to detect missing argument key.
Comment #4
NewZeal commentedKeith,
Can you download the latest dev code, check your change is in the code, test and report back so we can go beta: https://www.drupal.org/node/2846411
Thanks
Kent
Comment #5
keithm commentedKent,
Confirming patch #3 is included in commit c71890f07e8632ce7fe6984b2961782e426d85bd, and tested processing of empty viewsreference argument works as designed.
For future reference, would you please give credit to issue contributors in your commit messages? The template is given below in 'Credit & commiting'.
Thanks.
Keith
Comment #6
joekersI can confirm this is now working - thanks for reporting the issue and providing the patch.
Comment #7
NewZeal commentedComment #8
joekers