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.
I noticed this while testing #510910: When multiple fields share a column in table view only the last field displays. If you define a "Global: Custom text" field and give it the value "0", that won't show up in your view, apparently due to some render() related special case for rewriting and custom text handling. It's a separate bug from #510910 so I'm opening a new issue for it... Very obscure, so I'm calling this minor for now. ;)
Comment | File | Size | Author |
---|---|---|---|
#4 | 546586_0notEmpty-views2_1.patch | 1018 bytes | jeffschuler |
#1 | 546586-1.empty_and_0.patch | 2.28 KB | dww |
Comments
Comment #1
dwwBased on further investigation, we just aren't considering '0' to be valid alternate text nor empty text. Attached patch fixes (and applies cleanly to both DRUPAL-6--3 and HEAD).
Comment #2
dwwFrom IRC:
Tested and committed to HEAD and DRUPAL-6--3. Guess this is still minor, even though it's not as minor as I originally thought. ;)
Comment #4
jeffschulerBackporting this fix to Views 2 did not solve the issue for me.
render()
ing the values means that$this->last_render
has a string '0' instead of an int 0 -- need to test for this:Patch for 2.x-dev attached. I'm not sure whether this change is necessary for 3.x-dev as well.
btw, #559102: Views thinks that a 0 value is empty even when the box 'Count the number 0 as empty' is unchecked... looks to be a dup of this issue, where folks are still experiencing the issue, (as I was.)
Comment #5
sphopkins CreditAttribution: sphopkins commentedI have been posting in the other thread #559102: Views thinks that a 0 value is empty even when the box 'Count the number 0 as empty' is unchecked... and I am glad that someone has some ideas here.
I tested this patch on my machine and I do not thing that it worked. Note that I am using it on views 2.7.
I will post any results here
Comment #6
dashton CreditAttribution: dashton commentedI'm having the same issue- applied the patch and it didn't fix the problem. I'll keep looking into it and post what I find.
Comment #7
sphopkins CreditAttribution: sphopkins commentedNeed to verify this but when you apply the patch to 6.2.8 I get a whitescreen....That andViews 2.8 still does not display '0' at all when this patch is applied (properly as well... for some reason I did not apply it properly hence the whitescreen).Comment #8
merlinofchaos CreditAttribution: merlinofchaos commentedPatch in #4 looks correct to me, and it does fix the issues I can reproduce. If there are issues that it does not fix, they might be separate, but I don't know how to recreate them to test. I have committed it to all branches.
Comment #9
Aren Cambre CreditAttribution: Aren Cambre commentedSubscribe (in case this issue gets more attention later).
Comment #11
NaX CreditAttribution: NaX commentedI have just run into this same issue and the patch did not fix the problem I had.
I have a table view with CCK fields. One of the CCK text fields is sometimes empty. So I set the Empty text option, but it was not displaying the empty text.
After some investigation I found that because I also had the Link this field to its node option set the empty field was rendering empty links.
EG:
<a href="node/115"></a>
When I set the Hide if empty then only does the empty text get displayed.
Is this by design? The way I understand stood things, the un-rendered field is what should be checked for being empty and the hide if empty options remove the field from the display (Label and all, if possible) if empty.
If I understand things correctly maybe the render_text function should also check for empty text.
Hope that all makes sense.
Comment #12
merlinofchaos CreditAttribution: merlinofchaos commentedEmpty links seems like a different issue than not accepting 0 as empty. Call me crazy.
Comment #13
timbraeckman CreditAttribution: timbraeckman commentedI also have an issue like this. I have matches and when there is no score there is nothing stored in the database. But for some reason views show 0 instead of empty. I want it to show 0 when there is a 0 in the database and nothing when there is nothing in the database. Can anyone tell me how to fix this please?
Comment #14
esmerel CreditAttribution: esmerel commentedThis has been closed twice; it's a different issue if there's still a problem.