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 will propose a patch that hides a field (ie no new line is printed) if it is empty and if the "Hide if empty" checkbox is checked in the field configuration.
Comment | File | Size | Author |
---|---|---|---|
#1 | 2032863-hide_fields-1.patch | 437 bytes | guillaumev |
Comments
Comment #1
guillaumev CreditAttribution: guillaumev commentedHere is the patch.
Comment #2
killua99 CreditAttribution: killua99 commentedThe $content means the whole content view? the row? or just the field?
I'm lost in this part.
Comment #3
guillaumev CreditAttribution: guillaumev commentedIt means just the field.
The expected behavior, in my opinion, is that when you check "Hide if empty" in a field configuration, whenever the field is empty, it shouldn't print anything (ie not even a new line), which wasn't the case so far.
Comment #4
killua99 CreditAttribution: killua99 commentedWorks fine, as you say. well done!
Info for the maintainer:
Exist a patch to handle this issues and others. Please see #2032189-4: Multiple issue fixing in a single patch: Multiple issue fixing in a single patch and review others issues patch.
This is RTBC, and ready to apply.
Comment #5
killua99 CreditAttribution: killua99 commentedThanks guillaumev committed
Comment #7
attisanmy solution:
works for fieldCollections too.
greets
Comment #8
killua99 CreditAttribution: killua99 commentedWe need to take a look at those lines.
Comment #10
killua99 CreditAttribution: killua99 commented