diff --git a/modules/views_view_field/views_view_field_handler_include_view.inc b/modules/views_view_field/views_view_field_handler_include_view.inc index 53969f3..22c5d04 100644 --- a/modules/views_view_field/views_view_field_handler_include_view.inc +++ b/modules/views_view_field/views_view_field_handler_include_view.inc @@ -162,7 +162,11 @@ class views_view_field_handler_include_view extends views_handler_field { $view->init_style(); - // Important only for pdf views. With this action we assign the + if ($this->view->pdf->suppress_pdf_output == -1) { + $this->view->pdf->suppress_pdf_output = 1; + } + + // Important only for pdf views. With this action we assign the // PDF document to the new view if (isset($this->view->pdf) && is_object($this->view->pdf)) { $view->pdf =& $this->view->pdf; diff --git a/views_pdf_plugin_display.inc b/views_pdf_plugin_display.inc index ac4c4b5..3ad2e2c 100644 --- a/views_pdf_plugin_display.inc +++ b/views_pdf_plugin_display.inc @@ -112,6 +112,11 @@ class views_pdf_plugin_display extends views_plugin_display_page { $this->view->pdf->setViewsHeader($this->view->display_handler->render_header()); $this->view->pdf->setViewsFooter($this->view->display_handler->render_footer()); + // Add a flag for managing pdf output suppression + if (!isset($this->view->pdf->suppress_pdf_output)) { + $this->view->pdf->suppress_pdf_output = -1; + } + $html = $this->view->render($this->display->id); if (!empty($html)) { diff --git a/views_pdf_plugin_style_table.inc b/views_pdf_plugin_style_table.inc index c4d1ab8..5729575 100644 --- a/views_pdf_plugin_style_table.inc +++ b/views_pdf_plugin_style_table.inc @@ -17,6 +17,11 @@ class views_pdf_plugin_style_table extends views_plugin_style { * Render the style */ function render() { + + if ($this->view->pdf->suppress_pdf_output == -1) { + $this->view->pdf->suppress_pdf_output = 0; + } + $output = ''; $this->view->numberOfRecords = count($this->view->result); diff --git a/views_pdf_plugin_style_unformatted.inc b/views_pdf_plugin_style_unformatted.inc index b306e54..14f1e1c 100644 --- a/views_pdf_plugin_style_unformatted.inc +++ b/views_pdf_plugin_style_unformatted.inc @@ -27,6 +27,8 @@ class views_pdf_plugin_style_unformatted extends views_plugin_style { */ function render_grouping_sets($sets, $level = 0) { + $this->view->pdf->suppress_pdf_output = 0; + $output = ''; $next_level = $level + 1; @@ -52,11 +54,17 @@ class views_pdf_plugin_style_unformatted extends views_plugin_style { } $this->view->pdf->drawContent($set['group'], $options, $this->view); } - - if ($this->uses_row_plugin()) { - foreach ($set['rows'] as $index => $row) { - $this->view->row_index = $index; - $set['rows'][$index] = $this->row_plugin->render($row); + if (isset($this->view->pdf->render_flag)) { + } else { + $this->view->pdf->render_flag = array(); + if ($this->uses_row_plugin()) { + foreach ($set['rows'] as $index => $row) { + $this->view->row_index = $index; + if (!isset($this->view->pdf->render_flag[$index])) { + $set['rows'][$index] = $this->row_plugin->render($row); + $this->view->pdf->render_flag[$index] = FALSE; + } + } } } } diff --git a/views_pdf_template.php b/views_pdf_template.php index a3e16d0..7b02d8e 100644 --- a/views_pdf_template.php +++ b/views_pdf_template.php @@ -398,7 +398,16 @@ class PdfTemplate extends FPDI { } - if ($key !== NULL && $view->field[$key]->theme($row) || !empty($row)) { + if (isset($this->suppress_pdf_output)) { + $save_suppress_pdf_output = $this->suppress_pdf_output; + $this->suppress_pdf_output = 1; + } + $test_theme_row = $view->field[$key]->theme($row); + if (isset($save_suppress_pdf_output)) { + $this->suppress_pdf_output = $save_suppress_pdf_output; + } + + if ($key !== NULL && $test_theme_row || !empty($row)) { $this->SetX($x); $this->SetY($y); $this->renderRow($x, $y, $row, $options, $view, $key, $printLabels); @@ -532,6 +541,9 @@ class PdfTemplate extends FPDI { $content = strip_tags($content); } + if ($this->suppress_pdf_output == 1) { + return; + } // Write the content of a field to the pdf file: if (!empty($content)) { $this->MultiCell($w, $h, $prefix . $content, $border, $align, $fill, $ln, $x, $y, $reseth, $stretch, $ishtml, $autopadding, $maxh, $valign, $fitcell);