I want to display fields from the current node using a viewfield. The "display field" for those fields was not sufficient for me, especially the display formatters for repeating dates is very poor. So I created a view to display only those dates that start after midnight ("12AM today") or start in the past and are currently active (to date less than "now"). And for repeating dates I want to also display the next 4 upcoming dates.
But viewfield does not like "recursion" (even if there is no recursion), the Devel->Render-tab says. I am aware that recursion might be possible, but only if the output in the view renders the viewfield again.
A solution to solve this problem is to add an option to the viewfield to allow for recursion. This would make sense in some circumstances
Comments
Comment #1
keithm CreditAttribution: keithm commentedThis behavior is by design.
For better field formatting, you might consider writing a custom formatter. (See hook_field_formatter_info() to get started.) There is also a module that might help: http://drupal.org/project/custom_formatters.
Hope this helps.
Comment #2
Pepe Roni CreditAttribution: Pepe Roni commentedChanged this to a feature request: Can you provide a checkbox to the viewfield to allow for recursion in this viewfield?
Reason: I used complex views with Ajax pagers to page thru attached Images, Dates, display a calendar and so on. I have patched the original module to allow for recursion (in all viewfields :( )
Comment #3
keithm CreditAttribution: keithm commentedThere is a recent code change that loosened the restriction on recursion; see the discussion in #1181226: Remove viewfield_views_query_alter() function. It was committed yesterday so if you upgrade to the latest 7.x-2.x-dev you'll get it.
Comment #4
sunComment #5
keithm CreditAttribution: keithm commented@wbue: Is the current version 7.x-2.x-dev insufficient for your purposes? It wouldn't be particularly difficult to allow recursion per viewfield or viewfield/instance but I would like to know there's at least one use case for it :)
Comment #6
sunThis might work in the latest code already, but will ultimately be fixed with the patch in #1071212: Fix viewfield rendering
Comment #7
colan@keithm: Here's a use case for recursion:
This recursion described in the last step will only work if it is unblocked. It's a very simple means by which to display entire subtrees. No coding should be required.
Comment #8
sun@colan: It sounds to me that #1071212: Fix viewfield rendering should make that use-case work. Can you test the patch?
Comment #9
keithm CreditAttribution: keithm commented@colan: Viewfield has supported recursion for a long time. I myself have a site that uses viewfield to recursively list chapters and subsections in just the way you describe. It works fine for that. The current issue is concerned with the fact that Viewfield used to disallow the node containing the viewfield from being rendered at all in the viewfield output. In #1181226: Remove viewfield_views_query_alter() function we removed that restriction too, so as I said in #5, I'm not sure if there's still a problem any longer, and if so what the use case for it is.
Comment #10
colanI'm actually still working in D6 for this stuff, but I'll try to quickly throw together what I need to test this in D7. Stand by...
Comment #11
keithm CreditAttribution: keithm commented#1181226: Remove viewfield_views_query_alter() function applies to both 6.x-2.x and 7.x-2.x but not 6.x-1.x.
Comment #12
sunwell, you could also do us a favor and test the 6.x-1.x to 6.x-2.x upgrade path ;) (of course, make sure to do a backup first)
Comment #13
colanBut it looks like I need to do this on D7, as there's no D6 patch for #1071212: Fix viewfield rendering? I'm running 6.x-2.x-dev now, and the recursion isn't showing up.
I'll have to get to the upgrade path checking later. sorry. :)
Comment #14
keithm CreditAttribution: keithm commentedIf you're running on the latest 6.x-2.x-dev and your particular recursion isn't producing expected results, we'd like to understand the specifics of your case. Can you do a little more digging or produce a test install that illustrates your problem?
Also, FWIW, in my experience it's important to make sure the views are correct. I have often had a wrong argument or filter cause viewfield to produce no results.
Comment #15
colanI'll see what I can figure out.
Comment #16
colanComment #17
colanThanks for that tip, as that was exactly the problem. I forgot to include the viewfield in the fields list. ;)
It's all good now. I suppose we can say that this is fixed in D6 at least? I didn't test the D7 version.
Comment #18
sunThanks! 6.x-2.x and 7.x-2.x are more or less the same right now.