Hello,
The field is displayed even if it's content is empty ??? How can I hide it if there's no output value?
Thank you.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | computed_field-hide_empty_fields_not_in_db-1928178-13.patch | 1.83 KB | rjacobs |
Hello,
The field is displayed even if it's content is empty ??? How can I hide it if there's no output value?
Thank you.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | computed_field-hide_empty_fields_not_in_db-1928178-13.patch | 1.83 KB | rjacobs |
Comments
Comment #1
RedRat commentedThere is a semi-solution for this problem: http://drupal.org/node/1349904
But if you don't want to store field values in the DB, your field will be always visible, even if it empty. I am sure it's a bug in the code, but the module is almost not maintained now. :-(
Comment #2
rjacobs commentedIt would seem that this is not a problem for fields stored in the DB because they are tested as empty/non-empty each time the field is saved (via computed_field_field_is_empty()). If nothing is saved, then Drupal knows there is nothing to display.
Fields that don't use the DB for storage don't receive this "is_empty" check. However, I think it would be possible to implement a similar check at display time within computed_field_field_formatter_view(), which is what the attached patch attempts to do.
Perhaps others could test this out.
Comment #3
RedRat commentedI will try your patch as soon as return from vacation.
Comment #4
aaronbaumantested #2, works as described
let's get one more review for RTBC
Comment #5
anybodyI can confirm that
Thank you very much for the great work!
Comment #6
aaronbaumanComment #7
anybody=D Thanks. Forgot to select. Sorry xD
Comment #8
colanThanks! Looks great. I'll happily commit this once the extra whitespace is removed from line 348.
Comment #9
anybodyComment #10
anybody@colan: Please review and set RTBC again if it's ok!
Comment #11
colanThe corresponding issue for values stored in the DB is #1440234: Zeroes in string types are assumed to be empty (DB used for storage). Please review that one if you can as nobody's look at it yet.
@Anybody: No, sorry, I can still see whitespace there with Dreditor.
Comment #12
colanComment #13
rjacobs commentedLooks like this was one of my patches from long ago. Dunno how that whitespace got in there. I double-checked the the patch still applies cleanly, and though it does there is some offset. Because of this I went ahead with a re-roll (that also stripped white space).
Comment #15
colanThanks!