Hi. I have upgraded from views 2.11. to 6.x-3.x-dev to try out the new features.
When I run any views that implement hook_views_post_render(&$view, &$output), I get:
Fatal error: Call to a member function exposed_form_validate() on a non-object in ....\sites\all\modules\views\views.module on line 1073
I did the obvious things like:
- run update.php (there was nothing updated)
- check for any conversion under admin/build/views/tools/convert (nothing to convert)
- cleared cache
- I also tried to edit and save one of the views, so that it can save in view 3. But got the same error.
Please is there any upgrade that I need to do to the hooks, or is there an api change?
Unfortunately, I cannot the dump the views right now, as in production database.
I am using 6.x-3.x-dev of 2010-08-02.
Thanks for your help.
Comments
Comment #1
zeezhao CreditAttribution: zeezhao commentedFyi - I have some exposed fillters: date with from/to, node type, casetracker status.
The fields are mostly cck, or node fields,
Comment #2
dawehnerCan you pastebin the code you are using there? You might do something bad there.
As you can read in http://drupal.org/node/571990 a export is important.
Please try to reproduce the bug on a clean drupal installation and describe how to reproduce the problem.
Comment #3
zeezhao CreditAttribution: zeezhao commentedThanks for your reply. I have just narrowed it down to some code in the hook which I am using the redisplay the filters into $output. Its the line calling drupal_build_form(). Works well in 2.11:
Comment #4
dawehnerDo you set the display?
Please paste all important code :)
Comment #5
dawehnerIs the code you should use here.
It's important that you have set the current display already
Comment #6
zeezhao CreditAttribution: zeezhao commentedThanks for reply. Display is set to default.
Unfortunately cant post all code as need permission do to so first... Will try and get this or post a simulation, as it has dependencies on graphing etc.
But the general flow is the view produces results, however the results needs to be grouped and massaged in code. Hence use of hook_views_post_render(&$view, &$output).
- now the final output is done ok in views 3, but since its a dynamic report, the original filters need to be added in the output so the user can change anything and rerun if necessary.
- hence the need for the code above:
$output_filter = drupal_build_form('views_exposed_form', $form_state); //line causing bug
- and then for final output: $output = $output_filter . $output;
- so need to add the filters in front of output. Hence the use of drupal_build_form()
Tried the suggestion, but that wont work "Fatal error: Using $this when not in object context"
Comment #7
dawehnerThis needs intelligent usage
translates to
I don't think this is a bug this is the changed api of views3 :)
That's bad luck :)
Comment #8
Letharion CreditAttribution: Letharion commentedSeems to me dereine has answered the question, and it's been quite for a while, so I assume fixed. Please re-open otherwise.
Comment #10
zeezhao CreditAttribution: zeezhao commenteddereine's fix did not work. But was able to solve by adding extra line for exposed_form_plugin: