Hi!
Any way to hide labels for empty values? Checkbox 'Hide if empty' isn't work.

CommentFileSizeAuthor
#8 hide-empty.patch1.14 KBpowysm
#6 hide-if-empty.patch1.07 KBinternal

Comments

dmizrahi’s picture

Hello,
If the field is null it works, but if there is an empty string the field is shown. I don't know if it's on purpose or not.
What is your need in this case ?

If you know a little PHP, you can look at line 41 of the /includes/views/views_display_plugin_services.inc
if (isset($item->{$field->field_alias})) {
Isset check if it exist (not null) and not if its empty.

UksusoFF’s picture

why field_alias? why not value?

dmizrahi’s picture

it's $item->field_alias, and item is the view result. So item handle the value and need the alias of the field. Anyway, this line is the value check.

powysm’s picture

I am a little confused here on the comments.
I have a service view which is pulling back several custom content types which have different fields. So i add all the fields required, this then means each instance of the various content types get a field for all those listed even if they are not relevant to that content type and therefore have no content(value). These are then displayed as empty arrays. checking Hide empty does not resolve this. Based on what dmizrahi has said it sounds like it should?

dmizrahi’s picture

I don't work on this anymore but if you know some php, go in the source code and change it to match your requirement.
There are no mainteners for this module anymore.
I think you have to change how the test on hide_empty is managed.
Sorry i can't help you more.

internal’s picture

Version: 7.x-1.0 » 7.x-1.1
Component: Miscellaneous » Code
Status: Active » Needs review
StatusFileSize
new1.07 KB

There is the patch for that.

emerham’s picture

patch not working.

Working on one, but having issue hiding only fields that don't have content with the "hide_empty" option set for a field.

Also trying to get rewrite if empty working

powysm’s picture

StatusFileSize
new1.14 KB

In case it helps someone, this is doing the cleanup for me

generalredneck’s picture

Status: Needs review » Fixed

Modified #8 a bit and committed. Rewrite results seem to not work very well period, so that might be a new thing to worry about.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.