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.
Hi all and sorry for my language
I create "User" display in Drupal 6.15 Views 6.x-2.8. Then i create different types of profile fields in it and all fields values displays on user profile page normally but value of field "freeform list" is always empty on several Drupal projects. Value of this freeform list field shows up perfectly in Panels 6.x-3.2. How i can display this freeform list field in Views? Thank you.
Comment | File | Size | Author |
---|---|---|---|
#14 | views-freeform-list-675264-14.patch | 876 bytes | peck66 |
#13 | views_handler_field_profile_list.patch | 876 bytes | peck66 |
#9 | views-675264-9.patch | 1.07 KB | Ad_Astra |
#6 | views-675264-6.patch | 1.03 KB | Ad_Astra |
#1 | views_handler_field_profile_list.inc_.txt | 988 bytes | Ad_Astra |
Comments
Comment #1
Ad_Astra CreditAttribution: Ad_Astra commentedGot the same problem today. After messing with all that code for some hours, I found that a class in the file /modules/views/modules/profile/views_handler_field_profile_list.inc has a weirdly looking 'pre_render' method that has no foreach over the arguments array and doesn't return anything. I fixed it, and also commented out the 'render_item' method that gives an error (had no time to look why, sorry). If you look into the attachment to this comment, you'll see something that at least works.
Comment #2
Ad_Astra CreditAttribution: Ad_Astra commentedComment #3
Ad_Astra CreditAttribution: Ad_Astra commentedComment #4
dagmarSorry you didn't provide a patch.
Comment #5
merlinofchaos CreditAttribution: merlinofchaos commentedActive is better for "no patch attached" state.
Comment #6
Ad_Astra CreditAttribution: Ad_Astra commentedSorry, i'm quite a noob here, didn't know about those proper patch formats. now there is a patch in the attachment.
Comment #7
hop242 CreditAttribution: hop242 commentedIt works fine. Thank you so much Ad_Astra.
Comment #8
dagmarIf you add a new foreach, you should identate all the code inside it.
If you are removing a function, please, explain in the issue, why you are removing it, and don't comment the lines, simple, remove it.
Changing, status, removing all these not useful tags.
Comment #9
Ad_Astra CreditAttribution: Ad_Astra commentedfixed the patch.
so, why I removed that method. after I studied the structure of the array called '$values' used as an argument by 'pre_render()' and fixed the foreach issue, that 'render_item' method started giving me an error. I figured out that there is a check for 'render_item' method in the class, and if this method is not present, it's rendered some other way that actually worked (and, as I said before, I had no time to dig deeper, sorry). so I removed $this->items[$field]['item'] (replacing it with $this->items[$field][]) and this method.
Comment #10
merlinofchaos CreditAttribution: merlinofchaos commentedWhile it looks like you're right that perhaps the looping is wrong, the removal of render_item() is wrong. I believe that needs to be in there to allow the rewrite to work the way it is supposed to on grouped items.
Comment #11
trjohnson CreditAttribution: trjohnson commentedSame issue here.
The patch provided by Ad_Astra only returns the first row in the view. The subsequent rows still do not return a value. We've rolled back the file to the previous release and it has begun working once again.
Aside from the addition of the token values, what reason is there behind the other changes in the code?
Comment #12
peck66 CreditAttribution: peck66 commentedThanks for all your work on this guys.
Is Ad_Astra's patch returning the result "return parent::pre_render($value);" in the correct loop level?
I had _some_ extra success by shifting the return out one level - but I am very much a hacker and can't take it further at this stage.
Comment #13
peck66 CreditAttribution: peck66 commentedThis patch seems to work - and it doesn't remove the render_item() function.
Comment #14
peck66 CreditAttribution: peck66 commentedSame patch - better name.
Comment #15
dagmarThis code could be replaced by:
isn't?
Comment #16
peck66 CreditAttribution: peck66 commentedThnx for the review, dagmar :)
The item test you speak of was original code, so I didn't want to change it ...
http://php.net/manual/en/function.empty.php
says ...
I think someone might like
"0" (0 as a string)
to be a valid list entry, so perhaps it is better as it is?
Comment #17
dawehnerI think peck66 made a good argument, why this should be kept as in current code.
The current code is definitive total broken: $value is not set in that context.
Without manual testing just looking at the code, it looks fine.
PS: This would make http://drupal.org/node/420850 active again, because i removed the check for "," there.
The rest looks really fine
Comment #18
merlinofchaos CreditAttribution: merlinofchaos commentedCommitted to all branches. Thanks!
Comment #20
Anonymous (not verified) CreditAttribution: Anonymous commentedI'm experiencing trouble with the freeforms in views, this time in Drupal 7. It displays well when I ask views to show the complete user, but when I use fields, nothing appears.
I sometimes get this message :
Warning : Illegal offset type dans views_handler_field_profile_list->pre_render() (line 21 in [path_to_drupal]/sites/all/modules/views/modules/profile/views_handler_field_profile_list.inc).
So I wandered a bit in the php code, and I found the function a bit strange, but I'm not an expert : $this->items is set to an empty array in pre_render(). Then it calls get_values(), declared in the class views_handler_field_prerender_list (its parent), which calls get_items(). And get_items() asks for $this->items[$field], whereas $this->items is still empty...
But perhaps it just comes from a wrong configuration either in profiles or in views.
Comment #21
dagmarPozzo: Please fill a new issue following the Views issue submission guidelines. Thanks.