Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Jan 2009 at 07:52 UTC
Updated:
14 Feb 2009 at 19:50 UTC
In views 2.1, hook_views_pre_view passed a $display_id, however since:
http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/views/inclu...
- this was broken, because pre_execute() is not passed a $display_id.
There are 2 equivalent patches - the first just gets the current display with $display_id = $this->current_display;. The second alters the function call so that the $display_id is passed in from the caller. Both appear to work correctly in my cases, although I haven't really looked at previewing - take your pick which one you prefer :)
| Comment | File | Size | Author |
|---|---|---|---|
| pre_view_display_missing_pass_current.patch | 1.13 KB | owen barton | |
| pre_view_display_missing_get_current.patch | 692 bytes | owen barton |
Comments
Comment #1
brmassa commentedEarl,
i confirm the bug and the both patches fix it. But i recommend the first because its cleaner.
the only note i would make is on the first patch (*get_current.patch) is that instead
+ $display_id = $this->current_display;i would put+ $display_id = &$this->current_display;so modules would be able to modify it by calling the hook with reference values. Despite that, the patch is great.regards,
massa
Comment #2
merlinofchaos commentedSimply modifying the display ID won't actually help, as you also have to change $view->display_handler to reference the right handler. So making that a reference would probably do more harm than good.
Comment #3
brmassa commentedEarl,
well. Fair enough. It was in fact an extra "feature" that i imagined possible. The bug reported was actually fixed with the original patches.
regards,
massa
Comment #4
karens commentedSubscribing, any module using views_pre_view() has errors and cannot use either $display_id or $args until this is fixed (because the missing $display_id also shifts $args to the wrong position so that $display_id is now $args and $args is always empty). So basically views_pre_view(), a pretty basic Views hook, is unusable, which I think might qualify as critical.
Comment #5
merlinofchaos commentedOk, first patch committed. Thanks!