Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Unless I've lost my mind, a non-default display on the view in the view field will not properly receive any arguments. I've tracked it to this bit of code:
// Cache the child_view in this object to minize our calls to views_get_view.
$this->child_view = views_get_view($child_view_name);
$child_view = $this->child_view;
// Set the appropriate display.
$child_view->access($child_view_display);
// Find the arguments on the child view that we're going to need to use.
$configured_arguments = $child_view->display[$child_view_display]->display_options['arguments'];
Specifically the last line - $configured_arguments
ends up being NULL for any non-default display I'm trying. It seems that the non-default displays aren't being init'd properly, even though they should have their access method called. Not sure what's going on, but rather frustrating...please help/fix :)
Comment | File | Size | Author |
---|---|---|---|
#11 | vfv-argument.patch | 1.08 KB | markhalliwell |
#10 | 1013294-d7-fix-child-view-args-2.patch | 3.55 KB | lathan |
#9 | 1013294-d7-fix-child-view-args-1.patch | 2.87 KB | lathan |
#2 | 1013294-fix-child-views.patch | 3 KB | tizzo |
#4 | 1013294-fix-child-view-args.patch | 3.06 KB | Jonathan Webb |
Comments
Comment #1
Jonathan Webb CreditAttribution: Jonathan Webb commentedEnabling the option "Aggregate queries" introduces the problem. There is a caveat in the option description: Views Field View can attempt to aggregate your queries to prevent Views from running a separate query for each instance of this field. This option attempts to aggregate these queries. This may only work on simple views and will not support default arguments as one might expect. Unfortunately this feature either doesn't work or doesn't degrade nicely.
After enabling the option and saving the view, calling up the wrapper-view yields PHP notice:
"Notice: Undefined index: arguments in views_field_view_handler_field_view->pre_render() (line 135 of .../views_field_view/views_field_view_handler_field_view.inc)."
Comment #2
tizzo CreditAttribution: tizzo commented@Jonathan Webb - The feature works there was just a bug in the way query aggregation handles arguments on displays. The module was trying to pull the arguments from the appropriate display on the child view without looking at the default. When the desired display was default or where the child display had overridden arguments this was fine. However, when the arguments are not overridden they and the default display is not used, the arguments are in ['default'] and not in the array for the child display that is being used.
I replaced:
With:
It works properly for all the views I have tested.
Degrading nicely would be great but unfortunately there not really a way for the module to know whether aggregation caused unexpected results. Reviewing this again I think default arguments should work just fine. I'm not sure why i had put that in previously...
Comment #3
tizzo CreditAttribution: tizzo commentedCommitted.
Comment #4
Jonathan Webb CreditAttribution: Jonathan Webb commentedThere is still an issue in pre_render with the arg parsing.
$argument = substr($token, 1, -1);
- only works with field-based args ("[whatever]"), not argument-based args ("!1" or "%1"). Also, in general, when using argument-based args from the parent view, the reliance on the field_alias properties becomes problematic.Attached is a wrapper for Version Control API's commitlog_commit_items view. if you visit http://site/vfv-wrapper/[id] it should display a node with nid=id as well as the visual diff for a commit items with vc_op_id=id. In this wrapper view you can compare the result of using "!1" as the argument or "[nid]" as the argument. Using "!1" I was still getting an incorrect view result, even with tizzo's patch above.
I was able to get this working for my test case with the attached patch, but I'm not sure that I follow the logic in pre_render enough to call it a fix. The two places I'm unsure of (in my patched version) are at:
'values' => array($value),
-- this may need to be'values' => array_pad(array(),count($values),$value),
//if ($matching_item) {
-- I commented out this $matching_item condition because it fails if argument-based args are used; I know this isn't the right solution, even though it fixed my issue.Comment #5
webchickBoth tizzo and Jonathan are out this weekend, so we need an assessment on how to move forward.
Comment #6
tizzo CreditAttribution: tizzo commentedWorking on this...
Comment #7
sdboyer CreditAttribution: sdboyer commentedSolution incoming? *hopeful face*
Comment #8
lathanapplied patch to 7.x-dev and it get field arguments moving down to child view for me.
Comment #9
lathanhere is the patch rolled for D7...
got to try figure out what's happening to cause this error.
Comment #10
lathanMissed a line here so rerolled this patch.
Still getting the error described above, but now know that issue is because the view's row_index has not been set... still trying to figure out how to set that puppy.
Comment #11
markhalliwellActually it seems to be a bug with the token processing. Attaching a D7 patch.
Comment #12
nateman332 CreditAttribution: nateman332 commentedIt seems that someone is submitting a D7 patch without updating the report. tsk tsk tsk
By the way, has a solution been found for the 6.x-1.0-beta1 version? I'm having the same problem.
Comment #13
markhalliwellAfter the initial patch was committed in #3 there was another patch in #4. Both of these I believe are for D6. Because this issue lies in both versions (D6 & D7), I think that is why the version wasn't changed. Patches relating to D7, have it explicitly mentioned in the patch filename. Either way, someone from this module needs to come sort out this mess.
Comment #14
nateman332 CreditAttribution: nateman332 commentedI realize that there are patches for this, but none of them have been tested yet, so really there is no solid solution. Yeah, I agree, this needs some cleaning up.
Comment #15
jibranDrupal 6 compatible versions of the module are not supported anymore.