Closed (fixed)
Project:
Views Field View
Version:
8.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Apr 2017 at 14:24 UTC
Updated:
19 May 2026 at 14:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
codesmithSame issue. I'm trying to pass the nid. Neither of the suggested Replacement Patterns below work in the "Contextual filters" field
{{ raw_fields.nid }}
{{ fields.nid }}
If I put an integer in the field like "123" then it works.
Comment #3
codesmithComment #4
lincolnbergeson commentedRelated to https://www.drupal.org/node/2901328
Comment #5
codesmithThe issue in #4 isn't really related. This issue is about the value not being passed correctly. The issue in #4 is about the name of the token not being passed correctly.
Just a follow up - I have a multiple value field that contains 1 or more node ids. I wanted to pass those node ids to the child view, separated by a + sign. The field contextual filter wasn't working. I looked at the code and there's a lot of white space around the values. I tried stripping out the white space ala:
and it worked. Of course this only works for my use case of NIDs but maybe this will help others...
Comment #6
ankur.addweb commentedThe issue is passing the parameter for Contextual filters in view field.
You can pass parameters as:
See attached screenshot for passing a parameter using token.
Comment #7
trevorbradley commentedI similarly can't make this work. I tried adding my term {{ raw_fields.tid_1 }} in quotes as @kishna.addweb suggests, and I couldn't make it work either. If I add in the term staticly, it works fine.
If you can't pass in dynamic contextual filters based on the parent row's data, what's the point?
I must be missing something, plugging away at it.
EDIT: Appears to be fixed in 8.x-1.x-dev...
Comment #8
boinkster commentedI'm passing a portion of an Address field, Neither tokens work, but a static value does:
{{ fields.field_address_address_line1 }} returns no result
{{ raw_fields.field_address_address_line1 }} returns no result
Static Value - "111 3rd St" returns a result
EDIT: This works on the DEV version
Comment #9
gg24 commentedHi,
I tried reproducing this issue but couldn't do so.
I followed following steps:-
{{ raw_fields.nid }}inside view global field.Please let me know if I missed any step to reproduce.
Please check the attached screenshot.
Thanks!
Comment #10
purushotam.rai commentedI think it may be related to https://www.drupal.org/project/views_field_view/issues/2793785 #2793785: Using a field token with caps a contextual argument does not pass to child view
Comment #11
rconstantine commentedEven with the DEV version, I still had issues. Applying several outstanding patches worked for me. Hopefully, they'll be rolled in at some point.
Comment #12
johncionci commented@rconstantine
Could you post the patches that made this work?
Comment #13
andileco commentedRemoving this post, as things changed after updating to dev. Still a problem, but I'll look for a different issue.
Comment #14
andileco commentedComment #15
mholloway commentedTo clarify, it's the regular expression in the function getTokenArgument in src/Plugin/views/field/View.php that is the problem.
The regexp allows only lower case letters in the argument name. It should allow upper case too.
The patches referred to above may not match line numbers in the current source so may fail to apply.
The fix is to add A-Z into the regexp:
Comment #16
thirstysix commentedI want to pass multiple Contextual filters in the View Settings.
I passed the Contextual parameters like this using the replacement tokens.
{{ raw_fields.tid }}{{ raw_fields.tid_1}}
I tried with the comma separated and slash value also
{{ raw_fields.tid }},{{ raw_fields.tid_1}}
{{ raw_fields.tid }}/{{ raw_fields.tid_1}}
But, It can't pass the value in the particular embedded view.
how can i pass the more than contextual parameters?
Comment #17
thirstysix commentedI applied the patch. now it's working fine. Thanks.
Path: \modules\contrib\views_field_view\src\Plugin\views\field\View.php
Comment #18
isalmanhaider commented@ThirstySix, which patch did you use? could you please provide the exact link to it.
Thanks
Comment #19
thirstysix commentedthe above code, just replace in the view.php file
https://www.drupal.org/project/views_field_view/issues/2873359#comment-1...
and then check. Thanks
Comment #20
shoebob commented@ThirstySix, this patch results in this error for me:
When I view a page on the site I get a different kind of error message:
Appreciate any help you can give.
Comment #21
thomasmurphy commentedThis still seems to be a bug on the lastest release. Also, there is mentions of a patch but no attached patch file. I'm switching this to a bug report as I think that's a better fit.
Comment #22
thomasmurphy commentedComment #23
BioMac411 commentedThank you ThirstySix, this fixed my problem last year...
Needing to manually having to remember I did this, and spending hours re-remembering... I figure I'll just add the patch here so I can reuse on composer updates. It should be added to the module. Now last time module was updated the 'raw_' was added. It works great with a single element. I've got complicated ones that I'm actually running through a number of elements. With this patch, it allows me to sent multible through, not independently, but all at the same time.
shoebob I believe this is what you want to do. So with this patch, you can. Don't use the 'raw_' version but use just the fields version.
Edit to add:
I collect the Entity IDs, with the multiple settings (comma only separator, with no space) in one field first, then take that field to the next Global: View (field view) and for the Contextual filters I do not use the 'raw_fields.fieldname' I use the 'fields.fieldname',
this is where 'shoebob' above was going wrong. If one only has 1 element going to the Contextual filter, then the 'raw_fields.fieldname' works fine.
I just realized there is a major difference between 'Views Field View' and the 'Twig Tweak' module one could assume they do similar things. I can run my views templated fields through both, 'Views Field View' doesn't strip the 'style' tags that are needed, and the whole reason for having the template in the first place. 'Twig Tweak' still allows the template to work, but then strips out the 'style' tags on display. I'm also routing a lot of views through other views to easily build what is needed, a lot of rest apis using 'rest views' through 'rest_export_nested'. I have been following the Contenta project for years, but fine it easier to get exact output I need this way. when you wrap your mind around being able to push bootstrap code to a complicated angular app, and just render it with out complicated front end logic... one last issue I'd like maintainers to think about, I don't send multiple arguments along to get multiple views back, I send multiple arguments along, to get one object back, think JSON. this patch allows that.
With out the patch I'll get errors like below (for future Google searches)
Comment #24
BioMac411 commentedSorry, missed an 's' in the above patch, this one should fix this.
Comment #25
BioMac411 commentedfixed again with better file name too
Comment #26
joseph.olstadI haven't done a nit-pik on the patch but empirically patch 25 is working very well for us, thanks so much!
Comment #27
jukka792 commentedI applied the patch 25#, but just to clarify, is the passing of the 2 filters like this in the Contextual filters -field:
{{ raw_fields.nid_1}} / {{ raw_fields.id_1 }}I can't make it working, but trying to find where is the problem.
It only works with one,
{{ raw_fields.nid_1}}Comment #28
johnsicili25 is working for me. Thank you contributors :)
Comment #29
kazah commentedPatch #25 works fine.
I use view with one argument. Before I applied this patch only fixed value works (no token).
But I need to use
{{ fields.MYTOKEN }}, not{{ raw_fields.MYTOKEN }}.What is the difference between these two tokens? I don't undrestand at all.
Comment #30
douggreen commentedUpdated patch for latest for beta4
Comment #31
vladimirausThank you everyone for your contributions.
Merged. 🍻