Closed (won't fix)
Project:
Views (for Drupal 7)
Version:
5.x-1.x-dev
Component:
Documentation
Priority:
Minor
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
14 Oct 2007 at 18:56 UTC
Updated:
23 Sep 2008 at 07:53 UTC
After numerous discussions with merlinofchaos about the best way to conditionally include the code required for views support, we've settled on the following approach:
See attached patch. Seems to work great, but I wouldn't mind a little extra testing and confirmation from merlinofchaos that this is The Right Way(tm) to do this. If so, I'll update the appropriate views handbook pages, too.
| Comment | File | Size | Author |
|---|---|---|---|
| signup_views_include.patch.txt | 3.66 KB | dww |
Comments
Comment #1
merlinofchaos commented+1 from me
Comment #2
dwwCool, committed to signup's HEAD. Now I just gotta get that handbook page done. Still assigned to me, stay tuned. ;)
Comment #3
moshe weitzman commentedSounds good.
This is exactly the kind of dependency that i was trying to address for D6 with module_invoke() improvements but I must not have explained it well because Crell protested violently. chx liked it, anyway. there is always D7.
Comment #4
sunI don't know what to do with this issue in Views' queue. Moving back to Signup.
Comment #5
dwwIt's a documentation issue about how D5 modules should include views support. The above patch was how I solved it in signup's case (after many discussions w/ Earl), but this issue isn't about signup at all. Perhaps it should just be "won't fixed" since D6 views is much smarter about how its files are loaded, so this is basically a non-issue anymore. But, if anyone was still caring about and maintaining D5 views, it'd be nice to document the approach used by the above patch as the "best practice for D5 views support".
Comment #6
sunI am the one who cares about Views 1.x for now. However, we are in a situation where having documentation issues for it does not make sense IMO, because
- most modules for D5 implemented Views support similar to the patch for Signup, so developers should have sufficient examples
- users are slowly upgrading to D6
- no one really cares about support and documentation issues in this queue
- and I'm actually trying to decrease the size of this queue by 80% ;)
Comment #7
dwwFine by me. Cheers. ;)
Comment #8
merlinofchaos commentedIt turns out that loading conditional support for Views in hook_init() can fail. Sometimes, something will happen in hook_init() (I forget what triggers it, but it happens) that will require a re-build of the Views cache. If this happens before another module's hook_init(), which it can, it can cause that module's views support code to drop out.
For now, the only solution is to recommend that conditional including of views support code happen by proxy; that is, put the hooks in your .module file and have them pass through to hooks in the external file by including the file and calling the same function using a _ prepended to the function name.
Comment #9
dww@merlin: FYI: that's exactly what this patch does, and what I was saying would be nice to explain somewhere in the the D5 views developer docs.