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.

Files: 
CommentFileSizeAuthor
#1 2032863-hide_fields-1.patch437 bytesguillaumev

Comments

Status:Active» Needs review
StatusFileSize
new437 bytes

Here is the patch.

+++ b/views_pdf_template.php
@@ -394,7 +394,7 @@ class PdfTemplate extends FPDI {
+    if (!empty($view->field[$key]->options['exclude']) || (empty($content) && $view->field[$key]->options['hide_empty'])) {

The $content means the whole content view? the row? or just the field?

I'm lost in this part.

It 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.

Priority:Normal» Major
Status:Needs review» Reviewed & tested by the community

Works 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.

Priority:Major» Normal
Status:Reviewed & tested by the community» Fixed

Thanks guillaumev committed

Status:Fixed» Closed (fixed)

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

Issue summary:View changes

my solution:

<?php
-    if (!empty($view->field[$key]->options['exclude'])) {
+    if (!empty(
$view->field[$key]->options['exclude']) || (empty($row->_field_data['nid']['entity']->$key) && $view->field[$key]->options['hide_empty'])) {
?>

works for fieldCollections too.

greets